Steering in Flying Vehicles
by William Todd Scott · in Torque Game Engine · 04/19/2006 (12:20 pm) · 5 replies
Hey all,
In the updateForces() method of the FlyingVehicle class a snippet of the steering code looks like this:
steering.y = mSteering.y / mDataBlock->maxSteeringAngle;
steering.y *= mFabs(steering.y);
Can someone explain why the second line is necessary?
Thanks
Todd
In the updateForces() method of the FlyingVehicle class a snippet of the steering code looks like this:
steering.y = mSteering.y / mDataBlock->maxSteeringAngle;
steering.y *= mFabs(steering.y);
Can someone explain why the second line is necessary?
Thanks
Todd
#2
The interesting thing is that this doesn't seem to be in the code for non-flying vehicles.
Additionally, expanding the code snipped with one more line:
steering.y = mSteering.y / mDataBlock->maxSteeringAngle;
steering.y *= mFabs(steering.y);
torque += xv * steering.y * mDataBlock->steeringForce;
The maxSteeringAngle already scales the values. However, this is a linear scaling vs. the exponential dampening that you pointed out.
Thanks for your help. I don't like to assume what's going on too much when picking apart these physics simulations.
Todd
04/19/2006 (6:53 pm)
Yeah,The interesting thing is that this doesn't seem to be in the code for non-flying vehicles.
Additionally, expanding the code snipped with one more line:
steering.y = mSteering.y / mDataBlock->maxSteeringAngle;
steering.y *= mFabs(steering.y);
torque += xv * steering.y * mDataBlock->steeringForce;
The maxSteeringAngle already scales the values. However, this is a linear scaling vs. the exponential dampening that you pointed out.
Thanks for your help. I don't like to assume what's going on too much when picking apart these physics simulations.
Todd
#3
The end result being that maxSteeringAngle determines how far one has to move the controller (mouse?) in order to reach the vehicle's maximum turning rate; while steeringForce determines what the turning rate is at maximum steering input.
Or at least that's what I've determined by reading the code. I've done no empirical research to back it up though.
04/19/2006 (9:47 pm)
Also, note that in Vehicle::updateMove mSteering values are clamped to a range of (-)maxSteeringAngle to (+)maxSteeringAngle. So what we have here is steering.y in a range of -1 to 1. This then represents our steering input as a percentage, which is then multiplied by the vehicle's steeringForce. When the input reaches or exceeds maxSteeringAngle, full steering force should be applied. The end result being that maxSteeringAngle determines how far one has to move the controller (mouse?) in order to reach the vehicle's maximum turning rate; while steeringForce determines what the turning rate is at maximum steering input.
Or at least that's what I've determined by reading the code. I've done no empirical research to back it up though.
#4
Thanks for posting that...I misread how the maxSteeringAngle was working on my first pass through the code.
Todd
04/20/2006 (10:26 am)
Scott,Thanks for posting that...I misread how the maxSteeringAngle was working on my first pass through the code.
Todd
#5
04/24/2006 (9:34 pm)
Man, that steering angle stuff makes alot more sense now. I was literally just about to rip it out of my SpaceVehicle.
Torque 3D Owner Scott Richards