333GameStudio

PlanetRotation

Jan 17th, 2018
660
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. var rb: Rigidbody;
  2. var speedY : float;
  3. var speedZ : float;
  4. var torque : float;
  5. function Start(){
  6.  
  7. rb = GetComponent.<Rigidbody>();
  8.  
  9. }
  10.  
  11. function Update(){
  12.  
  13.  
  14.  
  15.  
  16. rb.AddTorque(transform.up * torque * speedY);
  17.  
  18.  
  19. }
  20. function FixedUpdate(){
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. rb.AddTorque(transform.forward * torque * speedZ);
  28.  
  29.  
  30. }
Advertisement
Add Comment
Please, Sign In to add comment