Game Development Community

Immobilizing a flying vehicle ?

by Aidan Sliney · in Torque Game Engine · 09/25/2007 (8:43 am) · 9 replies

Hi there.
I need to modify the flyingVehicle object so that steering doesn't result in giving the vehicle additional speed. Actually in my case i need the vehicle to do stationnary fly. Currently moving the mouse and hence modifying the steering will make the vehicle move away from its original position.
I couldn't find any relationship between Steering and Position/speed/acceleration in flyingvehicle.cc
any hint from you would be more than welcome !
Thanks !

#1
09/25/2007 (9:55 am)
Btw, I used David's modification from this thread :
http://www.garagegames.com/mg/forums/result.thread.php?qt=30371

which modify the direction of the hover jets. It prevents the vehicle from moving as much as before ... but i would really like to have its masscenter completely immobile !
Thans in advance !
#2
09/28/2007 (8:45 am)
Apparently, the center of mass stays at the same place whilst I'm moving the mouse (i.e. modifying slope of vehicle). But the hovering jets tends to add an horizontal impulsion when I stop moving it ...

I was wondering, do yo know a way to completely prevent the vehicle from leaving its initial spot and just let it rotate around its mass center ? Maybe by specifying constant values for its 3d-position or modifying the code so that x,y and z aren't updated ?

I really need help on this one, it would make my life easier for the next week :D !

Thanks !
#3
10/01/2007 (9:29 am)
I found something that almost works !
In flyingVehicle.cc, i just set mRigid.force to Point3F(0,0,0) in updateforces().
However it seems that whenever my vehicle collides with items it starts moving, slowly but surely ...
I couldn't find what to change in the c++ files to avoid that.

What I also did is setting a variable accessible from script (called InitialPosition). I then modified the calls to setPosition in vehicle.cc : setPosition(mDataBlock->InitialPosition, ...);

It results in the vehicle oscillating frenetically between 2 positions ...
Any idea ?
#4
10/02/2007 (7:01 am)
No takers ? :(
#5
10/02/2007 (8:19 am)
Ifyour looking for a hover style vehicle, perhaps look at a helicopter code. its has far better up and down controls then the flying vehicle code.
#6
10/03/2007 (1:50 am)
Interesting point, right. The center of mass seems not to be used in the source for the calculation of the rotation. The Point3F is received, but not used then anymore. I'm also interested in a solution that rolls/turns the ship through the center of the object (or better through the mass center) and not by an arbitrary point above the ship.
#7
10/03/2007 (3:34 am)
Ok, got it, I think !
Just need to set mrigid.linVelocity to Point3F(0,0,0) (did it in flyingvehicle.cc and vehicle.cc) and it does the trick !
Looks scaringly straightforward after all !

To summarize, now i have :
- a flyingvehicle that can only rotate around a fixed (in world coordinates) point
- that cannot be translated

- its center (set in blender) is at one extremity of the vehicle (for ODE-attaching purposes)
- the masscenter (set in datablock) is a few units behind the vehicle

- the vehicle sometimes freezess on collision with other shapes, but never for long thanks to Vis's fix
Vehicle Sticking Fix

Happy I am :D
#8
10/03/2007 (9:14 am)
Aidan: At which line did you set the mrigid.linVelocity?
#9
10/03/2007 (9:33 am)
In FlyingVehicle.cc : at the end of updateForces() .... ~ line 529
In Vehicle.cc : in updatePos.cc ...... ~line 1007
And it works so far !

I have an other question though :

I need my vehicle to start vertically and to be able to aim at points below only.
I tried to use an other dts file with a rotated vehicle. Works fine except for some of the commands :
- controlling the pitch (rotation around world X-axis) works the same way for both models
- BUT controlling the yaw (rotation around world Z-axis) results in an unwanted behaviour, i'd rather control the roll

The problem is that I've tried to modify the key bindings so that i can control roll instead of yaw (using $mvRollLeftSpeed) but it doesn't seem to have any effect on the vehicle.

Do you know if it's possible to access and modify the roll, or is the vehicle class designed so that roll is only an effect of turning ?

(don't know if i'm really clear ! if I'm not, nevermind, this is not a major issue !)