- Edited
trizZzle
Ok the tutorials really nice! I got the movement for the most part ready to go! One problem I'm facing is the camera, I want to make in first person so I've followed some tutorials and again I seem to be breaking it (or maybe they are out dated) right now I do have some code, it doesnt seem to work and for the life of me I dont know why (cause I dont know how it would work but here goes!)
func _unhandled_input(event):
if event is InputEventMouseButton : # lock camera and what not
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
elif event.is_action_pressed('ui_cancel') :
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED and not GameValues.inMenu : # make sure we are in first person and not in a menu
if event is InputEventMouseMotion : # if the event is mouse motion, rotate!
neck.rotate_y(-event.relative.x * 0.01)
camera.rotate_x(-event.relative.y * 0.01)
camera.rotation.x = clamp(camera.rotation.x,deg_to_rad(-30),deg_to_rad(60))
now from doing some debugging I can say that whatever InputEventMouseMotion is never triggered, ever.
Although any code before it is indeed triggering so something goes wrong there, as to how to fix it I'm early in learning this stuff and so far have not been able to figure it out. So your help would be nice, thanks!
Thanks!