@justinbarrett said:
I am still looking into mouse look stuff....maybe you could post your findings?
Sure. Here's all you need to know:
`
if event.type == InputEvent.MOUSE_MOTION:
#
var delta = get_fixed_process_delta_time()
#
- float() is not really necessary, I don't remember why I put it there
#
player.rotate_y(deg2rad(float(event.relative_x) delta MouseSensitivity))
helper.rotate_x(deg2rad(float(event.relative_y) delta MouseSensitivity))
`
That's pretty much all there is to it. And definitely a lot better than this:
yaw = fmod(yaw - event.relative_x * MouseSensitivity/70, 360)
pitch = max(min(pitch - event.relative_y * MouseSensitivity /10, 45), -25)
player.set_rotation(Vector3(deg2rad(pitch), deg2rad(yaw), 0))
Now, in my tree, the root node is the expected one, a KinematicBody (or RigidBody in kinematic or character mode). Then I add a "helper" node, which is just a Spatial, and all children of the root become children of this helper. So the hierarchy is like this Player -> helper -> *all the original Player children.
The trick is to rotate just one axis per node, so that helper is needed. If you rotate a node in more than one axis, due to how Euler rotations work, the character starts to roll eventually, which is exactly the problem with the example codes you can find out there. This on the other hand works flawlessly every time and it just requires an extra node.
BTW, I'm adding a chopper to my game and this method is as perfect as it is for the char. No unwanted yaw at all, no choppiness, etc.
If you need an example scene I can provide one, although I'm sure you saw the video already.
Cheers.
P.D. Mouse is captured in ready(), it gives more accurate input.