Hello all,
I’m having a cube in my scene with a rigidbody and I want the player to click the cube, the cube will jump, rotate in the air, fall down to fixed position.
This is the script I use:
void Update ()
{
rb.AddForce((magnet.transform.position - transform.position) * forceFactor * Time.smoothDeltaTime);
if (Input.GetKeyDown(KeyCode.A))
{
jumpingHeight = 200f;
rb.AddForce(0, jumpingHeight, 0);
rb.AddTorque(Random.Range(0, 500), Random.Range(0, 500), Random.Range(0, 500));
transform.rotation = Quaternion.identity;
}
}
Basically I want the cube to fall when all rotation is 0,0,0
I read in answers that rigidbody is hard to control, what would be your approach to this one?