I have a airplane mesh in a blueprint. It’s suppose to have a somewhat cartoonish behaviour, so I would like the plane to tilt slightly upwards when I brake. Kind of like what birds do when they “brake” in air before landing.
There’s the GetActorRotation and AddActorLocalRotation. I can make the actor tilt (pitch), and by reading the actor rotation I can also rotate it back until the actor pitch reads zero again. The problem with that is that the plane actor also will travel in the pitch directon. Meaning if I tilt it upwards when I brake, the plane will also begin to go upwards in direction. Instead of staying in it’s current direction while tilting it’s body.
I do want the plane to go in it’s pitch and yaw direction. That’s how I control the movement obviously. So what I really would want to do is to rotate the mesh during brakes, not the actor.
So there’s the AddLocalRotation function for the mesh. But I then want to rotate it back to zero once the actor speed has come to a full stop (or if I begin to accelerate again). Since I have a bunch of Lerps and functions to calculate a smooth tilt angle for the brake tilt, I really have no means of knowing the mesh’s actual rotation. I mean, I’ve been adding small values over time to the local rotation. And it appears as if there’s no “GetMeshRotation” to read the actual rotation.
Basically, how do I set the rotation on a mesh to zero when I don’t know the current rotation?