Physics

In Unity, physics simulation primarily focuses on the use of the Rigidbody component. When the Rigidbody component is attached to any object, it will be taken over by the physics engine. The object will fall with gravity and bump into any object that has a collider. In our scripts, making use of the OnCollision function and the OnTrigger function requires a Rigidbody component to be attached to at least one of the two interacting objects. However, a Rigidbody component can interfere with any specific movement we might cause the object to take. Every Rigidbody, though, can be marked as kinematic, meaning the physics engine will not move it. The CharacterController component that we used for our tank is a special, modified Rigidbody. In ...

Get Unity Android Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.