Help with Flight Controls
by J.P. Berry · in Torque Game Engine · 10/14/2007 (6:03 pm) · 6 replies
So , I have been messing around with the Flight Game Example, it is a great resource to have. I have been fiddling around with the controls but cannot seem to get the Yaw and Roll to seperate. Basically, I want to be able to look left to right with the mouse without rolling at all. The mouse is really just used for aiming. And I would like to use the "A" and "D" keys to make the craft roll in that direction. The way it currently sits, whenever I move the Yaw (X axis) with the mouse, it makes the craft turn slightly left and also roll in that direction if you are moving. Here is my current flight model that I have been extensively tweaking to no avail:
drag = 0.2;
density = 1.0;
minDrag = 90; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 10; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
maxAutoSpeed = 15; // Autostabilizer kicks in when less than this speed. (meters / second)
autoAngularForce = 15; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 15; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 0.95; // Dampen control input so you don't' whack out at very slow speeds
maxSteeringAngle = 1; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 10; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 100; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 3500; // Horizontal jets (W,S,D,A key thrust)
steeringForceY = 1250;
steeringForceX = 900;
steeringRollForce = 1; // Steering jets (how much you heel over when you turn) 8
rollForce = 250; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 8; // Height off the ground at rest
createHoverHeight = 8; // Height off the ground when created
jetForce = 4500; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 55; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 0.7; // Energy use of the afterburners (lower number is less drain)
vertThrustMultiple = 10.0;
integration = 3; // Physics integration: TickSec/Rate
collisionTol = 0.1; // Collision distance tolerance
contactTol = 0.1; // Contact velocity tolerance
mass = 100; // Mass of the vehicle
bodyFriction = 0; // Don't change this.
bodyRestitution = 0.5; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 0; // Don't change this.
I thought that steeringRollForce would work if I set it to 0, but it does not work the way I need. Can anyone help?
drag = 0.2;
density = 1.0;
minDrag = 90; // Linear Drag (eventually slows you down when not thrusting...constant drag)
rotationalDrag = 10; // Anguler Drag (dampens the drift after you stop moving the mouse...also tumble drag)
maxAutoSpeed = 15; // Autostabilizer kicks in when less than this speed. (meters / second)
autoAngularForce = 15; // Angular stabilizer force (this force levels you out when autostabilizer kicks in)
autoLinearForce = 15; // Linear stabilzer force (this slows you down when autostabilizer kicks in)
autoInputDamping = 0.95; // Dampen control input so you don't' whack out at very slow speeds
maxSteeringAngle = 1; // Max radiens you can rotate the wheel. Smaller number is more maneuverable.
horizontalSurfaceForce = 10; // Horizontal center "wing" (provides "bite" into the wind for climbing/diving and turning)
verticalSurfaceForce = 100; // Vertical center "wing" (controls side slip. lower numbers make MORE slide.)
maneuveringForce = 3500; // Horizontal jets (W,S,D,A key thrust)
steeringForceY = 1250;
steeringForceX = 900;
steeringRollForce = 1; // Steering jets (how much you heel over when you turn) 8
rollForce = 250; // Auto-roll (self-correction to right you after you roll/invert)
hoverHeight = 8; // Height off the ground at rest
createHoverHeight = 8; // Height off the ground when created
jetForce = 4500; // Afterburner thrust (this is in addition to normal thrust)
minJetEnergy = 55; // Afterburner can't be used if below this threshhold.
jetEnergyDrain = 0.7; // Energy use of the afterburners (lower number is less drain)
vertThrustMultiple = 10.0;
integration = 3; // Physics integration: TickSec/Rate
collisionTol = 0.1; // Collision distance tolerance
contactTol = 0.1; // Contact velocity tolerance
mass = 100; // Mass of the vehicle
bodyFriction = 0; // Don't change this.
bodyRestitution = 0.5; // When you hit the ground, how much you rebound. (between 0 and 1)
minRollSpeed = 0; // Don't change this.
I thought that steeringRollForce would work if I set it to 0, but it does not work the way I need. Can anyone help?
#2
10/14/2007 (9:46 pm)
The problem is that I don't want the ship to tilt at all when I move the mouse over left or right. I have already set two different bindings for the move and turn functions. Though, even if I use the turn left at speeds, it still pitches over. Torque uses yaw with roll, I need to seperate the two.
#3
rollForce = 0; // Auto-roll (self-correction to right you after you roll/invert)
10/15/2007 (7:52 am)
SteeringRollForce = 0; // Steering jets (how much you heel over when you turn) 8rollForce = 0; // Auto-roll (self-correction to right you after you roll/invert)
#4
I need A and D to control the roll now. Any other suggestions? I think it would be a good resource for those who are doing and type of flight game. The current setup of having yaw and roll together is not right at all. It is arcade-like, but not what I am going for. Thanks for the help so far guys!
10/15/2007 (12:42 pm)
Yes, well that removes the roll completely, and does give the proper controls to the mouse. However, the roll feature is now removed completely and does not work at all on the keyboard. With the roll off the left and right functions now just strafe the vehicle.I need A and D to control the roll now. Any other suggestions? I think it would be a good resource for those who are doing and type of flight game. The current setup of having yaw and roll together is not right at all. It is arcade-like, but not what I am going for. Thanks for the help so far guys!
#5
10/16/2007 (12:26 am)
Post in the private forums, I cant post any code here.
Torque 3D Owner Cyberkada
Triluminary Design Studios
(I use the left and right arrow keys)
moveMap.bind( keyboard, right, moveright );
moveMap.bind( keyboard, left, moveleft );
to moveMap.bind( keyboard, right, turnright );
and moveMap.bind( keyboard, left, turnleft );
You will have to also change the bindings in your prefs.cs file
It worked for me.