- Home /
Rolling aircraft when rotating towards an object
Hello everybody,
I'm trying to rotate aircraft through an object. Lets think about a target cube. My aircraft going to it with its forward vector.
this.transform.position += this.transform.forward * dt;
Quaternion lookTo = Quaternion.LookRotation(targetDirectionP);
this.transform.rotation = Quaternion.Slerp(this.transform.rotation, lookTo, dt); //Quaternion.RotateTowards
As a natural aircraft movement, I'm trying to roll aircraft around its forward vector by DT while turning but its forward vectors y value changes quickly. How can I handle this problem? I've tried every combination of Quaternion class' rotate functions but none of them works.
When I try to make Quaternion multiplication like below;
this.transform.rotation = Quaternion.Euler(this.transform.eulerAngles.x, this.transform.eulerAngles.y, dt) * this.transform.rotation;
it is turning crazy and forward vectors Y value is still changing.
Your answer
Follow this Question
Related Questions
issue after 360 degrees rotation 1 Answer
Preventing rotation of rigidbody at a specific rotation 0 Answers
How would I interpret angular displacement from target rotation to max out at 180°? 3 Answers
Child of a gameobject lookAt only around Y-axys 1 Answer
Need help converting Euler-based rotation to Quaternion-based (gimbal lock). 1 Answer