+1 vote

I'm making aerial vehicle controller, which can rotate 3 axis: X(Pitch), Y(Yaw), Z(Roll).

Rotating x(pitch) and y(yaw) axis works fine, however after I rotated z(Roll) axis, x/y rotation gave me weird result, it seems like it still rotating just like z axis didn't rotated(0).

First I thought that it was some kind of gimbal lock problem, but it wasn't, it still happens using quaternion.

Here's the video I demonstrate:

Note that I tried all these and had same results:

# Using Euler
rotation.x += pitch

# Using Euler II

# Using Quaternion
var qRot = Quat(transform.basis)
var r_euler = qRot.get_euler()
var new_rot = Vector3(r_euler.x + pitch, r_euler.y, r_euler.z)
var new_basis = Basis(qRot)
var new_transform = Transform(new_basis.x.normalized(), new_basis.y.normalized(), new_basis.z.normalized(), transform.origin)

Is there a something that I missed? Any advice will very appreciate it.

in Engine by (139 points)

1 Answer

+1 vote

Rotating by local axis by rotateobjectlocal, now it works.

by (139 points)

Hi, I am stuck there too, can you write what you have changed in the code

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.