Real-like drone movement help (problem when z axis goes from negative to positive)

edited for updates: How can I convert a 360 degree rotation to a 0 to 90 degree angle so that my drone appears to tilt sideways by reading its own Z base rotation value

guys please help me:

i have this ai drone that tilts forward when moving towards player and reverses back to normal when stopping - great

What I’m doing now:
I also want him to tilt sideways based on which direction he is turning, so I took the Z axis and plugged it into the Y axis so that as it turns it tilts the drone either positively or negatively, i even setup a FInterp so that it goes back to 0 (although this is my first time using one) and I also clamped the value from -50 to 50 so that it won’t turn upside down…

The problem:
When the Z axis goes from a negative to a positive value it doesn’t interpolate slowly between either value it just jumps… for example it could be going slowly following my (player character’s movement) from 40 degress down to 0 but if it is at 40 and then i make the drone turn so that it goes to a negative 40 degrees it just jumps ( it doesn’t interpolate smoothly)…
I’m going to explain it once more in another way:The z is at 40 degrees , interp to 0 is smooth, but interp from 40 to -40 just “switches” between the positive and negative value (instead of going smoothly from 40 to 0 to -40 it goes 40 boom -40 in less than an event tick)

check out my graph and video please, thanks in advance!

video: helpmeue4community - YouTube

pleas help, i tried using pawn control rotation instead of world rotation and it didnt fix it

so i figured the actual problem is that the Z axis goes 360 degrees (0 to 180 and then it turns into -180 to 0 or vice versa of opposite directions)


I only need 90 degrees of movement for my Y axis to simulate an actual drone tilting sideways

I need to find a way to make it so that 360 degrees becomes a 0 - 90 degree value but i have not figured out how

For physics control, you don’t want to read the X / Y / Z rotator values – Euler angles are not physical quantities.

Instead, you want to get the basis vectors of the object (local X, Y, and Z vectors) and dot them with the appropriate vectors of the world coordinate space (typically, up,) to determine the amount of tilt, and which direction the object is tilted.

dot(object_right, world_up) means sideways tilt – positive tilted left, negative tilted right
dot(object_forward, world_up) means front/back tilt – positive means tilted back, negative tilted forward

Question: wouldn’t you want the y-axis (or roll) to be linked to the rate of change in the z-axis (yaw), not the instantaneous value of the z-axis?

yes i thought of that as a possible solution,but have not figured how to do that… i tried getting base turn rate but have not figured out how to convert that so it becomes degrees of tilt…

I’m going to try this, i will report back in a few days, im travelling to another country soon…