Attached video shows what I'm talking about the best.
I'm trying to change the pitch on my submarine, which is a rigidbody. I've been using apply_torque() on the Y axis for yaw control/left&right steering, which works great. But trying to use apply_torque() on the X axis doesn't work as expected, instead it seems like it's using the global X axis rather than the local X of the player/submarine.
When facing one direction, the pitch control works as expected (first part of video) by raising the nose up and down. When you turn 90 degrees though, the pitch control seems to control the roll (Z axis) instead (second part of video). Turning 180 degrees makes the pitch control inverted (last part of video).
#Rigidbody, Apply torque on local axis
1 messages · Page 1 of 1 (latest)
Looking at the code pic, yaw_player() works because it's on the Y axis. pitch_player() is the one not working correctly when facing other directions
I tried apply_torque(transform.basis.x * value), but that gives the same result
I'm not great with vector maths, but perhaps something like apply_torque(Vector3(value*cos(rotation.y), 0, value*sin(rotation.y))