Can't Flying
by Stephen · in Torque Game Engine · 05/29/2006 (2:11 pm) · 11 replies
Sorry about the title, I added "ing" after Fly. I didn't mean to.
I have added the TGE Vehicle Resource and the WheeledFlyingVehicle resource to my project and they both work but I have came across a problem with the aircraft. When I mount the aircraft I can't move forward and I get this error in the console,
Here's the function in the commands.cs that makes the aircraft move forward,
I think the problem is that when I mount the aircraft and try moving forward, that function doesnt know what to look for. How can I fix this problem?
Thanks,
Tek0
I have added the TGE Vehicle Resource and the WheeledFlyingVehicle resource to my project and they both work but I have came across a problem with the aircraft. When I mount the aircraft I can't move forward and I get this error in the console,
base/server/scripts/commands.cs (243): Unknown command getThrottleLevel. Object (1924) Player -> ShapeBase -> GameBase -> SceneObject -> NetObject -> SimObject
Here's the function in the commands.cs that makes the aircraft move forward,
function serverCmdThrottleUp(%client)
{
%vehicle = %client.getControlObject();
if (isObject(%vehicle))
%vehicle.setThrottleLevel(%vehicle.getThrottleLevel() + 1);
}I think the problem is that when I mount the aircraft and try moving forward, that function doesnt know what to look for. How can I fix this problem?
Thanks,
Tek0
#2
Oh, I was trying different things and that function above isnt like the function from the flyingvehicle resource. It's suppost to look like this.
05/29/2006 (4:22 pm)
I'm using this to set control of the vehicle.%obj.setControlObject(%vehicle);
Oh, I was trying different things and that function above isnt like the function from the flyingvehicle resource. It's suppost to look like this.
function serverCmdThrottleUp(%client)
{
%vehicle = %client.player;
if (isObject(%vehicle))
%vehicle.setThrottleLevel(%vehicle.getThrottleLevel() + 1);
}
#3
is your player.cs onMount correct..
function Armor::onMount(%this,%obj,%vehicle,%node)
{
if (%node == 0) {
%obj.setTransform("0 0 0 0 0 1 0");
%obj.setActionThread(%vehicle.getDatablock().mountPose[%node],true,true);
%obj.lastWeapon = %obj.getMountedImage($WeaponSlot);
%obj.unmountImage($WeaponSlot);
%obj.setControlObject(%vehicle);
%obj.client.setObjectActiveImage(%vehicle, 2);
}
}
and are you setting your control object on collision?
06/06/2006 (2:59 am)
I agree with paul.. sounds like the problem is with your control object..is your player.cs onMount correct..
function Armor::onMount(%this,%obj,%vehicle,%node)
{
if (%node == 0) {
%obj.setTransform("0 0 0 0 0 1 0");
%obj.setActionThread(%vehicle.getDatablock().mountPose[%node],true,true);
%obj.lastWeapon = %obj.getMountedImage($WeaponSlot);
%obj.unmountImage($WeaponSlot);
%obj.setControlObject(%vehicle);
%obj.client.setObjectActiveImage(%vehicle, 2);
}
}
and are you setting your control object on collision?
#4
06/06/2006 (8:26 am)
The only thing that I was missing was the setControlObejct line. But when I added that I got a error when mounting the vehicle.base/server/scripts/vehicle.cs (117): Unknown command setObjectActiveImage. Object LocalClientConnection(1554) GameConnection -> NetConnection -> SimGroup -> SimSet -> SimObject
#5
Firstly make sure you have the suggested changes to player.cs with control etc..Then
In your Aircraft.cs change the ServerCmd Functions to below,
please someone let me know if there is any issues or a better way of doing this
--------------------------------------------------------------------------------------
function serverCmdThrottleUp(%client)
{
%WheeledFlyingVehicle = %client.getControlObject();
%WheeledFlyingVehicle.setThrottleLevel(%WheeledFlyingVehicle.getThrottleLevel() + 1);
}
// The key command for thottleup
moveMap.bindCmd(keyboard, "up", "commandToServer(\'ThrottleUp\');", "");
function serverCmdThrottleDown(%client)
{
%WheeledFlyingVehicle = %client.getControlObject();
%WheeledFlyingVehicle.setThrottleLevel(%WheeledFlyingVehicle.getThrottleLevel() - 1);
}
// The key command for thottleDown
moveMap.bindCmd(keyboard, "down", "commandToServer(\'ThrottleDown\');", "");
--------------------------------------------------------------------------------------------------------
06/06/2006 (7:56 pm)
-----------O.K This works!!! ---------Firstly make sure you have the suggested changes to player.cs with control etc..Then
In your Aircraft.cs change the ServerCmd Functions to below,
please someone let me know if there is any issues or a better way of doing this
--------------------------------------------------------------------------------------
function serverCmdThrottleUp(%client)
{
%WheeledFlyingVehicle = %client.getControlObject();
%WheeledFlyingVehicle.setThrottleLevel(%WheeledFlyingVehicle.getThrottleLevel() + 1);
}
// The key command for thottleup
moveMap.bindCmd(keyboard, "up", "commandToServer(\'ThrottleUp\');", "");
function serverCmdThrottleDown(%client)
{
%WheeledFlyingVehicle = %client.getControlObject();
%WheeledFlyingVehicle.setThrottleLevel(%WheeledFlyingVehicle.getThrottleLevel() - 1);
}
// The key command for thottleDown
moveMap.bindCmd(keyboard, "down", "commandToServer(\'ThrottleDown\');", "");
--------------------------------------------------------------------------------------------------------
#6
06/07/2006 (4:47 am)
Nice work :)
#7
06/07/2006 (4:43 pm)
No problems Tank!, have fun
#8
06/07/2006 (8:48 pm)
For some reason, I still get the same error in the console. I have made sure that I changed the functions in the commands.cs and the default.binds.cs. I have no idea why I still get the errors. I gues I'm going to have to start from square one and see what happens.
#9
its a little bit messy and need some work, but at least it will start you above square 1. I guess maybe with all your efforts you could have changed much more than you expected, it happens to me all the time.
06/07/2006 (9:10 pm)
Tek0, http://www.rackspace.jp/gmdev/AiroScript.zip Heres my aircraft.cs, and player.csits a little bit messy and need some work, but at least it will start you above square 1. I guess maybe with all your efforts you could have changed much more than you expected, it happens to me all the time.
#10
Why? help please....
06/27/2006 (12:27 pm)
I have this problem...My airplane not flying....don't move for exactily....Why? help please....
#11
10/13/2007 (7:35 pm)
I cant get it to work either. That link you put up with the files is broken.
Torque Owner Paul /*Wedge*/ DElia
Does, as it's probably not getting along completley with that custom class you're using. I think the method for setControlObject may have changed in more recent versions of TGE from when that was made too, but I'm not totally sure.