A value of zero indicates that the object should not bounce at all, while a value of one indicates that all the speed of the object should be preserved. The higher the restitution, the more velocity is preserved when the object collides with another. The restitution of a Material determines how "bouncy" the Material is. The Collider also stores a Material, which describes how it reacts when in collision with other objects. This can be useful in some particular scenarios – for example you can connect such a body to another body using a joint, and feed the simulated positions into your skinning system. Unity Physics still simulates the body, but it cannot collide with anything. Note: It is possible to create a Collider which has a null BlobAssetReference. For example, a SphereCollider is built from a position and a radius, while a ConvexCollider is built from a point cloud. Each of the Collider types implement an ICollider interface, and for each Collider type, there is a static Create() function, which takes parameters specific to the shape. The most important property of a PhysicsCollider is a BlobAssetReference to the Collider data used by the physics simulation (which is in a format optimized for collision queries). For example, if a collision geometry can be represented by a sphere, you can write collision tests which only need to consider the sphere center and radius with a mesh wrapping the same sphere, you would need to consider every triangle in the mesh. It is analogous to a mesh in a rendering system.įor performance reasons, you should try to avoid using a mesh during physics – use specialized primitive types when possible, which greatly simplifies the process of determining collisions between two Colliders. This component decides what the collision geometry "looks" like to the physics simulation. By adding this component to an entity, you declare that this body will participate in the physics simulation and collision queries (though you also need transform components: Translation and Rotation for dynamic bodies, Translation, Rotation, and/or LocalToWorld for static bodies). This is the most important component for the simulation of physics. This document describes each of these components, so you can write systems which process these to apply game effects, or even create simulated bodies from code. Various physics systems read from these components to generate input to the simulation.Several conversion systems ( PhysicsBod圜onversionSystem, PhysicsShapeConversionSystem and PhysicsJointConversionSystem) read the PhysicsShapeAuthoring, PhysicsBodyAuthoring and joint scripts (there are several types of joint scripts), convert them to components and add them to your entities.Under the hood, when Unity Physics starts simulating the scene: In the getting started section, you've learned how to setup and configure bodies and shapes.
0 Comments
Leave a Reply. |