-
Notifications
You must be signed in to change notification settings - Fork 2
Physics
Green Tea has only 3 types of components (currently) to make entities obey Newton's laws: Rigidbody2D, BoxCollider, CirlceCollider. To make all this happen the Engine uses a library name: box2d. Reading the documentation of the library might prove helpfull to you if you want to have a full understanding of how things work.
It is important to note here that not all entities are handled by box2d. In order for an entity to handled by box2d it must have both a Rigidbody and one of the previously mention colliders. It's also very important to understand that entities that are handled by box2d should only be update the Transformations and Velocities during the FixedUpdate method.
According to box2d a rigidbody is: "A chunk of matter that is so strong that the distance between any two bits of matter on the chunk is constant. They are hard like a diamond." They are three types of Rigidbodies:
-
Staticbodies are not affected by gravity forces and wouldn't move by changing their Velocity.Staticbodies also don't collide with other type rigidbodies expect the dynamics ones. -
Kinematicbodies are moved by their Velocity but not are affected by the gravity forces.Kinematicbodies also don't collide with other types rigidbodies expect the dynamics ones. -
Dynamicbodies are movable objects that are affected by the gravity forces.Dynamicbodies collide with all other types rigidbodies, as well as between them.
-
BoxCollidergives a box like shape to the entity that is attached to. It enables the entity to collide with others. -
CircleCollidergive a circle shape to the entity that is attached to. It enables the entity to collide with others.