While working on the flappy bird tutorial, I noticed that we used the rigidbody2D component many times. I’ve mentioned Rigidbodies briefly in my colliders post, but thought it would be more beneficial to further learn the specifics of the Rigidbody2D component, since we used it the most. It is important to learn about each part of the rigidbody, so you can properly use it.
I went to the Unity documentation and found an article specifically on Rigidbody 2D called Rigidbody 2D. I learned that many of the concepts in the regular Rigidbody component are found in the Rigidbody2D component. The component takes over the Transform component and reprograms it based off of what is defined in the Rigidbody component. Any Collider2D added to the GameObject that has your Rigidbody attached will be connected to the Rigidbody2D. According to the article, if you need to move your collider, you need to move the Rigidbody 2D. The reason for this is because it makes sure your collision detection is good and give you the best performance. A good thing to know is that all the Collider2D is added to your Rigidbody won’t collide with each other. As I previously mentioned there are 3 body types for the Rigidbody2D: kinematic, dynamic, and static. Each type defines the movement behavior and interaction with the collider 2D. Any Collider2D attached will receive the body type of the Rigidbody2D it is attached to. You need a collider for the Rigidbody 2D to collide with another Rigidbody 2D. Rigidbody2D:
Technologies, Unity. “Rigidbody 2D.” Unity - Scripting API: Physics.Raycast, docs.unity3d.com/Manual/class-Rigidbody2D.html.
0 Comments
Leave a Reply. |
AuthorI'm a student at Durham School of the Arts, and currently in the Game Art Design pathway. I like playing the Sims 4, playing with dogs, and riding horses. This blog will reflect my learning and discoveries. Archives
May 2019
Categories
All
|