Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Spatial
- func _ready():
- var x;
- var y;
- var mouse_sensitivity;
- set_process_input(true);
- # set the mouse sensitivity of the mouse
- var view_sen = 0.2
- Input.set_mouse_mode(2);
- func _input(ie):
- #get present rotation of the scene node
- var x = rad2deg(get_node(".").get_rotation().x);
- var y = rad2deg(get_node(".").get_rotation().y);
- #now get the rotation of the mouse, with mouse x and mouse y
- var x = fmod(x - ie.relative_x * 0.2, 360);
- var y = fmod(y - ie.relative_y * 0.2, 90);
- #now just set the values
- get_node(".").set_rotation(Vector3(deg2rad(x), 0, 0));
- get_node(".").set_rotation(Vector3(0, deg2rad(y), 0));
- print ("" , x);
- print ("" , y);
Add Comment
Please, Sign In to add comment