|
Gravity Engine 12.0
Unity Asset for Gravity
|
N body collision. Script that is attached to NBody models (i.e. the mesh model that is a child of an NBody object) to handle collisions. Allows a choice of absorb, bounce or explode and adjusts physics as required to conserve momentum. More...
Public Types | |
| enum | CollisionType { ABSORB_IMMEDIATE , ABSORB_ENVELOP , EXPLODE , BOUNCE , EXPLODE_OR_BOUNCE } |
| Type of collision response. | |
Public Attributes | |
| CollisionType | collisionType = CollisionType.ABSORB_IMMEDIATE |
| int | collisionPrecedence = 1 |
| Precedence of collision script if both bodies have them. Lower takes precedence. | |
| GameObject | explosionPrefab |
| Game object holding the explosion prefab. Must be inactive and have a DustBallFromNBody script. | |
| float | explodeOrBounceVelocity = 0 |
| Velocity threshold for explosion if EXPLODE_OR_BOUNCE type. | |
| float | bounceFactor = 1f |
| (For a bounce collision) This factor is applied to determine the recoil velocities. 1 indicates no energy loss in the collision. | |
| string | collisionLayer = null |
| Optional collision layer. If set, require objects to be on this layer for OnTrigger processing. | |
N body collision. Script that is attached to NBody models (i.e. the mesh model that is a child of an NBody object) to handle collisions. Allows a choice of absorb, bounce or explode and adjusts physics as required to conserve momentum.
NBodyCollision is trigger based so the model game objects MUST:
Thanks to JAB for the EXPODE_OR_BOUNCE code.