Contents
Should I use rigidbody 2D?
1 Answer. Rigidbodies are required when you want the engine to handle collision detection for you. If you want to prevent your character from walking through other objects with colliders (like walls), then you either have to check for walls in your own movement code or you need to add a rigidbody to your player.
Can you have a collider without a rigidbody?
There is an option to add ‘isTrigger’ property in any collider and you can listen to TriggerEvent in your script. This will work without having a rigidbody at all. But you do need to have colliders on the objects that have to collide.
What is the difference between Rigidbody and Rigidbody 2D?
A Rigidbody 2D component places a GameObject under the control of the physics engine. Many concepts familiar from the standard Rigidbody component carry over to Rigidbody 2D; the differences are that in 2D, objects can only move in the XY plane and can only rotate on an axis perpendicular to that plane.
When to use rigidbody2d.moveposition in Unity?
2D rigidbodies have a fixed limit on how fast they can move therefore attempting to move large distances over short time-scales can result in the rigidbody not reaching the specified position during the next physics update. It is recommended that you use this for relatively small distance movements only. It is important to understand that the
What’s the difference between rigidbody 2D and rigid body?
See in Glossary component carry over to Rigidbody 2D; the differences are that in 2D, objects can only move in the XY plane and can only rotate on an axis perpendicular to that plane. The Rigidbody 2D component appears differently in the Unity Editor depending on which Body Type you have selected. See Body Type, below, to learn more.
Is there a limit to how fast rigidbodies can move?
2D rigidbodies have a fixed limit on how fast they can move therefore attempting to move large distances over short time-scales can result in the rigidbody not reaching the specified position during the next physics update. It is recommended that you use this for relatively small distance movements only.
How does collision detection work with rigidbody 2DS?
When the Collision Detection is set to Continuous, GameObjects with Rigidbody 2Ds and Collider 2Ds do not pass through each other during an update. Instead, Unity calculates the first impact point of any of the Collider 2Ds, and moves the GameObject there. Note that this takes more CPU time than Discrete.