http://dl.dropbox.com/u/38606641/Heli/build.htmlW - increase rotor speed (up)
S - decrease
A - Roll left
D - Roll right
Mouse - Pitch and yaw (point and aim)So I'm working on this helicopter build and it was quite simple up til polishing. The problem is that I'm adding force on the Y axis as a spinning rotor should but helicopters alter the angle of their propellers to create attack against the air and pull them in a certain direction. Clearly that is too complex to add.
So what I'm wanting to do is take what I currently have and add a fake force in the direction you are flying. So if you roll right and tilt forward it grabs the two rotational values and multiplies them into the force additive in direction that you are already moving. I want to amplify what I currently have without adding force on the rotor (y, which is up).
It's kind of obvious once you play that you have to tilt 90 degrees to move forward because force is only added from the rotor on Y (self).
So, suggestions on how to do that? Getting the direction and adding some fake force into it. It can be per frame because I want it to grow and hit the clamp, then stop at a maximum like everything else.
I'm basically translating a scripted example, but I do not want to approach it the same way he has and I want to use different controls so I think the math is going to be different.
My approach is more "real" I think, and easy to create in playmaker but hits a wall on realism without this extra math and angle calculations.
var controlTorque : Vector3 = Vector3(
Input.GetAxis( "Vertical" ) * forward_Rotor_Torque_Multiplier,
1.0,
-Input.GetAxis( "Horizontal2" ) * sideways_Rotor_Torque_Multiplier
);
This is the major difference I can't seem to translate into Playmaker.
While this may seem confusing, it is really rather simple. The control input torque
vector is equal to the input axes multiplied by the control sensitivity. The reason the Y
value is set to 1.0, is because we want to simulate the torque on the body created by
the spinning of the rotors. This is the easiest way to apply that force without adding too
much extra code.
Now if the main rotor is active, then we wish to apply the net torque to the helicopter
body as well as the lift force created by the spinning rotors, so we simply write...
if ( main_Rotor_Active == true ) {
torqueValue += (controlTorque * max_Rotor_Force * rotor_Velocity);
rigidbody.AddRelativeForce( Vector3.up * max_Rotor_Force * rotor_Velocity );
}
So thats that, any help would be great. I'm in the dark with these vectors combined with math.