HoverVehicleData
by AndyGFX · in Torque Game Engine · 08/16/2004 (3:33 am) · 14 replies
I looking for correct HoverVehicleData Set values. My current setting is't good. Hover jumping up/down/left/right. :)
Any experience wih this? ...
Any experience wih this? ...
About the author
#2
09/13/2004 (7:39 am)
Wow, Martin, that's just what I was looking for, and it's a lot clearer and in parts then the official documentation and fills in some vital missing information. You've got to get that into the documentation, or at least replace the blank descriptions of normalForce, stabLenMin and stabLenMax that are there.
#3
12/30/2004 (11:56 am)
This works GREAT!!! Thanks alot! But the craft keeps running away and never seems to stop completely.any thoughts on this?
#4
By default hovers have no brakes. The brakingForce is basically extra drag that is applied once you stop giving it thrust, and the vehicle reaches the actvation speed for them.
Me myself, I like air brakes for hovers, so I gave them some. It's real easy to do too...
in hoverVehicle.h in the class definition:
class HoverVehicle : public Vehicle
somewhere after the first private section begins, add:
in hoverVehicle.cc at the bottom of the function:
void HoverVehicle::updateMove(const Move* move)
add this:
now down in the function:
void HoverVehicle::updateForces(F32 /*dt*/)
find the if that reads : (around line 640)
and change it so it reads so:
After a recompile it should put on the brakes whenever you press the brake key.
12/30/2004 (12:32 pm)
You know I forgot all about my setup for this untill you asked....By default hovers have no brakes. The brakingForce is basically extra drag that is applied once you stop giving it thrust, and the vehicle reaches the actvation speed for them.
Me myself, I like air brakes for hovers, so I gave them some. It's real easy to do too...
in hoverVehicle.h in the class definition:
class HoverVehicle : public Vehicle
somewhere after the first private section begins, add:
bool mBraking;
in hoverVehicle.cc at the bottom of the function:
void HoverVehicle::updateMove(const Move* move)
add this:
mBraking = move->trigger[2];
now down in the function:
void HoverVehicle::updateForces(F32 /*dt*/)
find the if that reads : (around line 640)
if (mThrottle == 0.0f &&
mLeftThrust == 0.0f &&
mRightThrust == 0.0f &&
vellen != 0.0f &&
vellen < mDataBlock->brakingActivationSpeed)and change it so it reads so:
if ( (mThrottle == 0.0f &&
mLeftThrust == 0.0f &&
mRightThrust == 0.0f &&
vellen != 0.0f &&
vellen < mDataBlock->brakingActivationSpeed) || mBraking )After a recompile it should put on the brakes whenever you press the brake key.
#5
12/31/2004 (1:02 am)
Awesome! Thank you alot! This really helps...
#6
12/31/2004 (5:51 am)
How can you give it a nice pull away(acceleration) but limit it's top speed? maxThrustSpeed does not work... And why are high speed collision so unstable and "jerky"? Any thoughts? thanks...
#7
maxThrustSpeed = (mainThrustForce + strafeThrustForce) / dragForce;
remove that and you can actually set a value to it.
As for collisions, check this thread:
www.garagegames.com/mg/forums/result.thread.php?qt=17384
12/31/2004 (11:03 am)
The reason maxThrustSpeed doesn't work is because in HoverVehicleData::preload it is set as a function of the vehicles performance.....maxThrustSpeed = (mainThrustForce + strafeThrustForce) / dragForce;
remove that and you can actually set a value to it.
As for collisions, check this thread:
www.garagegames.com/mg/forums/result.thread.php?qt=17384
#8
First: I'm not a big fan of the way the hover vehicles will not stop turning. There doesn't seem to be any drag or damping applied, so, for example, if I turn the vehicle to the right, it will keep rotating clockwise until I turn back to the left. (Does that make any sense?) =P
I've tweaked "gyroDrag" but this only affects how quickly the vehicle turns. And "dragForce" apparently only applies to lateral velocity.
The other issue: I can stop the vehicle completely, but then it will accelerate slowly on its own, always in the same direction. I'm not sure what the actual direction is but it seems to be diagonal up and to the right (if you're looking at the mission map top-down). It would make sense for it to do this on a slope, but this is on a (supposedly) flat surface. (I used the Set Height tool on the terrain so it ought to be flat, right?)
Anyone got any experience with these issues or have any ideas on how to fix them?
Thanks!
Kevin
12/31/2004 (3:52 pm)
Hey, while we're on the subject, I've got a couple of issues...First: I'm not a big fan of the way the hover vehicles will not stop turning. There doesn't seem to be any drag or damping applied, so, for example, if I turn the vehicle to the right, it will keep rotating clockwise until I turn back to the left. (Does that make any sense?) =P
I've tweaked "gyroDrag" but this only affects how quickly the vehicle turns. And "dragForce" apparently only applies to lateral velocity.
The other issue: I can stop the vehicle completely, but then it will accelerate slowly on its own, always in the same direction. I'm not sure what the actual direction is but it seems to be diagonal up and to the right (if you're looking at the mission map top-down). It would make sense for it to do this on a slope, but this is on a (supposedly) flat surface. (I used the Set Height tool on the terrain so it ought to be flat, right?)
Anyone got any experience with these issues or have any ideas on how to fix them?
Thanks!
Kevin
#9
01/01/2005 (3:49 am)
The brakeforce should hold the hover in place one you get stopped. Somewhere you are getting an extra force applied, as if mForwardThrust and mLeftThrust aren't getting zeroed but rather have some minute value.
#10
So, yeah, any ideas why this extra force is being applied and where it's coming from?
Oh, and I really need the hover vehicle to turn more like the normal player... If someone could clue me in as to what I need to change I would appreciate it. I'm willing to jump into the code and rewrite it if necessary, but if I'm just missing some setting in the datablock I'd like to know before I do anything drastic.
Thanks again,
Kevin
01/06/2005 (6:14 pm)
@Martin: Thanks! That was pretty much what I thought, so I'm glad you confirmed it! =PSo, yeah, any ideas why this extra force is being applied and where it's coming from?
Oh, and I really need the hover vehicle to turn more like the normal player... If someone could clue me in as to what I need to change I would appreciate it. I'm willing to jump into the code and rewrite it if necessary, but if I'm just missing some setting in the datablock I'd like to know before I do anything drastic.
Thanks again,
Kevin
#11
As for the turning, there's no setup I know of that will change the behavior through datablock settings. Hovers by their nature are meant to have the slippery sliding behavior. I imagine you will end up needing to modify the hover physics, so that steering is not simply a way to rotate the vehicle(and thus change the direction that it's rear thrusting exherts force) but a way to both rotate and change the direction of momentum at the same time.
01/07/2005 (3:34 pm)
I really can't think of where the extra force could be coming from, I've never had that crop up I don't suppose you have an un-centered joystick feeding moves to Torque?As for the turning, there's no setup I know of that will change the behavior through datablock settings. Hovers by their nature are meant to have the slippery sliding behavior. I imagine you will end up needing to modify the hover physics, so that steering is not simply a way to rotate the vehicle(and thus change the direction that it's rear thrusting exherts force) but a way to both rotate and change the direction of momentum at the same time.
#12
I agree that the hover vehicle is supposed to be slippery... the quandary that I'm experiencing is that there is friction or damping being applied to the vehicle's linear momentum, but *nothing* seems to affect the rotational (angular?) momentum. I.E. There seems to be absolutely no way to damp or otherwise adjust the angular velocity without applying opposing force, e.g. turning the vehicle the opposite direction.
Are we on the same page yet? =) I don't want to change the thrust vector, or anything like that, I simply do not want the vehicle to continue rotating forever!
Anyway, thanks for the ideas... I guess I'm gonna jump into the HoverVehicle class and see if I can figure out what the hell is going on. =)
I'll let y'all know what I come up with (if anything).
Kev
01/07/2005 (7:15 pm)
@Martin: Yeah, I don't even have a joystick hooked up right now... good thought, though.I agree that the hover vehicle is supposed to be slippery... the quandary that I'm experiencing is that there is friction or damping being applied to the vehicle's linear momentum, but *nothing* seems to affect the rotational (angular?) momentum. I.E. There seems to be absolutely no way to damp or otherwise adjust the angular velocity without applying opposing force, e.g. turning the vehicle the opposite direction.
Are we on the same page yet? =) I don't want to change the thrust vector, or anything like that, I simply do not want the vehicle to continue rotating forever!
Anyway, thanks for the ideas... I guess I'm gonna jump into the HoverVehicle class and see if I can figure out what the hell is going on. =)
I'll let y'all know what I come up with (if anything).
Kev
#13
Looking at updateForces, drag is applied to that angular momentum down near the very bottom; torque -= mRigid.angMomentum * mDrag;
You can set a different value in the datablock for drag (which is actually a variable derived from the shapebase class), or try a different value just for that line since drag is also applied to the hovers movement.
01/08/2005 (10:35 am)
Oh I finally see what you are reffering to, and yes that's rather annoying.Looking at updateForces, drag is applied to that angular momentum down near the very bottom; torque -= mRigid.angMomentum * mDrag;
You can set a different value in the datablock for drag (which is actually a variable derived from the shapebase class), or try a different value just for that line since drag is also applied to the hovers movement.
#14
01/09/2005 (5:36 am)
Kevin, you mean the way that if you move your mouse a little left the craft keeps spinning at that velocity until you "center" your mouse again? You want it to be like halo or unreal tournament 2004, where the rotation gets zeroed out to where your pointing the mouse? I would also like to know that coz I hate it when it keeps spinning. I'll try and figure it out :)
Torque 3D Owner Martin "Founder" Hoover
I would recommend just driving around for a while to get used to the handling, then go in and change one or two variables and try it again. So far I have found the descriptions I made for the variabls to be correct so they should provide a good idea for what the variables do.
If you find that terrain or building collisions tend to crash the game, try setting bodyFriction to zero.
dragForce = 0.7; //* constant drag force, slows more when not thrusting
vertFactor = 0.7; //* 0-1 applys higher drag when "airborne"
floatingThrustFactor = 0.5; //* if the hover is "airborne" (meaning it is higher above terrain then
// the stabLenMax) multiply thrustforce by this to determine how much thrust
// to allow
floatingGravMag = 2.5; //* higher numbers cuts out air time, keeping the vehicle very close to the terrain
maxThrustSpeed = 140 / 1.67;//*
mainThrustForce = 70; //* normal forward force
reverseThrustForce = 60; //*
strafeThrustForce = 20; //*
turboFactor = 1.4; //*
//*
brakingForce = 75; //* the force applied for brakes
brakingActivationSpeed = 4; //* the speed at which automatic breaking is applied
//*
stabLenMin = 4; //* hovers basically ride on a spring, which during normal movement keeps the vehicle within
stabLenMax = 5.5; //* the following values distance from the ground
stabSpringConstant = 300; //* higher values provide for less bobbles from bumps and direction changes
stabDampingConstant = 200; //* higher values quickly smooths out residual up and down motion from landings and bumps
gyroDrag = 30; //* determines turning rate of vehicle lower values provide for quick turn responce, but are less
//* normalized and hard to control. lower numbers also decrease the effect of the direction the car is
//* facing upon its actual direction of momentum.
normalForce = 30; //* normalizes the vehicles roll and pitch with respect to the terrain. High numbers provide
//* a stable smooth positioning. Low numbers allow more roll and pitch and increases terrain collisions
restorativeForce = 20; //* how fast the vehicle will be restored to paralell over the terrain; higher is faster
steeringForce = 100; //* the rate of turn for the vehicle, higher is faster
rollForce = 20; //* this makes rolling/banking (turning) more responsive (higher numbers reduces the ability
//* to turn 180 degrees without changing the direction of momentum.
pitchForce = 20; //* higher numbers gives more force and movement for pitching the nose up/down