Add force and rotate object at the same time

Viewed 719

object layout and force way

like in the picture I want to add a force to a parent object in such a way that it will rotate 90 degrees while moving right and up. I stored the position below the object to help the rotating motion but I dont know any way to put into code.

1 Answers

I think what you are looking for is AddForceAtPosition

Applies force at position. As a result this will apply a torque and force on the object.

GetComponent<RigidBody>().AddForceAtPosition(Vector3.right, child.transform.position);
Related