#Airplane roll
1 messages · Page 1 of 1 (latest)
You mean it's currently turning through Yaw and you want to make it turn through roll?
yeah
trying to make it roll until it's finished turning to it's new yaw position
but i'm not sure how to grab the current rotating direction on the current frame.
Not sure if it would work for you, but you could store the _rb.rotation before the interpolation and calculate the angle between the previous and current values using Vector3.SignedAngle, the sign itself should be enough to tell you how it is rotating (i.e negative would be left and positive would be right)
okay cool i'll give that a shot
Actually, you need to store the foward vector, not the _rb.rotation, but the idea is the same
lol idk if i'm using this correctly. xD I think i'm running into trouble because "Vector3.Signedangle" is expecting another transform position not a rotation.
Vector3 targetRotation = _targetHeading.eulerAngles;
Vector3 forward = transform.forward;
float bankDirection = Vector3.SignedAngle(targetRotation, forward, Vector3.up);
Debug.Log($"Bank Angle: {bankDirection}"); //getting -90 or 90.
but i'm not sure how to handle it when i just have a quaternion rotation. because the ai plane is not targeting a specific position in space. it's just moving forward with the ability randomly yaw left and right. but now i'm just trying to add a little flair to the yawing left and right by adding the tilt/roll.
it's like what i would wish to do is some how tap into the angular velocity of the rigid body. but when i set the rotation via quaternion.slerp it's not applying any forces.