enableRotation just for 1 axis

Hi there, We have an helicopter flying using AIPath and some lerping. for the take off and landing. Everything fine, except now we wanted to make the helicopter tilt a little bit on the X axis when it flies, as you know helicopters fly tilting the front part down a bit.
So yeah I wanted to do this but since I have enableRotation = true because I want the Y axis to look on front of the path its also making the X axis to go back to 0 every time.
Anyway. to fix this which is not hardcoding the Base class?

Thanks in advance.
pistoleta

Hi

You can additionally set ai.updateRotation to false. This will decouple the rotation of the AI from the rotation of the transform. You can then read the rotation of the AI from ai.rotation and combine it with your desired tilt in any way you want.

See https://arongranberg.com/astar/docs/aibase.html#updateRotation

Yes, this seems what I was looking for. Just tried and seemed to work nice for a moment, but then realized the rotation in ai.rotation is not being updated, it’s all time 0.

 transform.rotation = Quaternion.Euler(flyRotationX, aiPath.rotation.eulerAngles.y,  aiPath.rotation.eulerAngles.z);

Im following the helicopter around the path is following and aiPath.rotation.eulerAngles.y and aiPath.rotation.eulerAngles.z are always 0.

Is this the value im supposed to read?
Thanks again

Hi

Make sure you have ai.enableRotation set to true. Otherwise the rotation will indeed always stay at zero.

Yes, I was going to add that, enableRotation is true. it’s very strange

The only particularity is I have disabled the script AI Path since Im using my own animations for the take off, once I have the helicopter in the Y position and rotation I want then I enable again AIPath script and Recalculate route.

I add some screenshots:

Hi

If the AIPath script is disabled it will not update the rotation property. Maybe that’s the problem?

yeah but. I enabled it when I finish with the takeoff, now im using aiPath.canmove=false instead and works fine.
For some reason the script doesn’t like to be disabled and enabled, it doesn’t calculate the rotations anymore, but if I use canmove=false and when I takeoff canmove=true everything fine.

Thanks a lot