Guest User

Godot error

a guest
Sep 5th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. extends Spatial
  2.  
  3. func _ready():
  4. var x;
  5. var y;
  6. var mouse_sensitivity;
  7.  
  8. set_process_input(true);
  9.  
  10. # set the mouse sensitivity of the mouse
  11. var view_sen = 0.2
  12. Input.set_mouse_mode(2);
  13. func _input(ie):
  14.  
  15. #get present rotation of the scene node
  16. var x = rad2deg(get_node(".").get_rotation().x);
  17. var y = rad2deg(get_node(".").get_rotation().y);
  18.  
  19. #now get the rotation of the mouse, with mouse x and mouse y
  20. var x = fmod(x - ie.relative_x * 0.2, 360);
  21. var y = fmod(y - ie.relative_y * 0.2, 90);
  22.  
  23. #now just set the values
  24. get_node(".").set_rotation(Vector3(deg2rad(x), 0, 0));
  25. get_node(".").set_rotation(Vector3(0, deg2rad(y), 0));
  26.  
  27. print ("" , x);
  28. print ("" , y);
Add Comment
Please, Sign In to add comment