Advertisement
LeeMace

Spin objects on all 3 axis

Dec 1st, 2022 (edited)
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.34 KB | Gaming | 0 0
  1. private float maxTorque = 10;
  2.  
  3.  void Start()
  4.     {
  5.      //spins the objects on a range on all 3 axis
  6.  targetRb.AddTorque(RandomTorque(), RandomTorque(), RandomTorque(), ForceMode.Impulse);
  7.      }
  8.      
  9.       //spins the objects on a range on all 3 axis
  10.     float RandomTorque()
  11.     {
  12.         return Random.Range(-maxTorque, maxTorque);
  13.     }
Tags: torque spin
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement