- Home /
Best way to rotate around a point with a RigidBody
I am making a game in which I need to use a rigid body 2d to move an object around a certain point. Any ideas on how to do this ?
Answer by Fariborzzn · Dec 20, 2019 at 09:07 PM
take a look at it : https://answers.unity.com/questions/338656/rotate-rigidbody-around-point.html
Im sure you can make it with transform.rotatearound(); In a Unity2D z axis is into the screen.. you'll want to rotate around the Z axis: Vector3.forward or Vector3(0,0,1)
try this :
transform.RotateAround(point, new Vector3(0,0,1), Time.deltaTime * rotationspeed);
Can you use this to collide? I didn't manage to get it working
For detecting collide you should use rigid body and collider component. the code I wrote for you will handle rotating around specific point. if you have any issue with that share it here I will be glad to help
Answer by Armegalo · May 10, 2020 at 11:51 AM
I have noticed minor physics errors rotating with the Transform instead of the Rigidbody