Learn more about collision machines and what you can use them for.
Collision machines are Unity components that are added to game objects. They’re mostly used for game mechanics involving collisions, like a projectile hitting a target.
A collision machine component can be added through the components menu (Makinom > Machines > Collision Machine) or the scene wizard (Add Machine > Collision Machine). A game object with a collision machine is represented in the Unity scene view by this gizmo icon:
You can learn more about machine components in general and their basic settings here.
A collision machine is started when a game object collides with the machine’s game object. This requires collider and rigidbody components on the game objects.
By default, collision machines can only be started when colliding with the player’s game object. Optionally, they can also be started by other game objects – this can further limited to game objects with a defined name, tag or component attached.
Started when another game object starts colliding with the machine’s game object. It’s implemented in the component’s OnCollisionEnter and OnCollisionEnter2D functions.
This start type will automatically initialize the following local variables.
The Collision Enter start type can optionally be limited by a layer mask. This can be used to only start the machine when colliding with game objects of a defined layer.
This start type can be used to let an explosive barrel explode when hit by a projectile. Use a Spawn Prefab node to spawn a particle effect prefab and a Play Sound node to play an audio clip.
Started while another game object continues colliding with the machine’s game object. It’s implemented in the component’s OnCollisionStay and OnCollisionStay2D functions.
The Collision Stay start type can optionally be limited by a layer mask. This can be used to only start the machine when colliding with game objects of a defined layer.
This start type can be used to play particle effects on the contact points while colliding. Use a Spawn Prefab node to spawn a particle effect prefab, using the local Vector3 variable list point for the contact points.
Started when another game object stops colliding with the machine’s game object. It’s implemented in the component’s OnCollisionExit and OnCollisionExit2D functions.
This start type can be used to add force to a rigidbody after a collision. Use one of the Rigidbody nodes (e.g. a Rigidbody Explosion Force node) to add force to a game object’s rigidbody.
Started when a particle collides with the machine’s game object. It’s implemented in the component’s OnParticleCollision function.
This start type can be used to damage enemies or the player (i.e. reducing a health variable) through particles. Use a Change Variables node to change the health variable.
Started when a character controller collides with the machine’s game object or a game object collides with the machine’s character controller – both require the character controller to perform a move in that frame. It’s implemented in the component’s OnControllerColliderHit function.
This start type can be used to push game objects out of the way of the character controller. Use one of the Rigidbody nodes (e.g. a Rigidbody Change Velocity node) to move a game object through it’s rigidbody.