Makinom - Game Toolkit for Unity
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom

Guide

Getting Started

  • Introduction
  • First Steps
  • Game Starters
  • Components Overview
  • Upgrading a Makinom 1 Project

Editor

  • Makinom Editor Overview
  • Node Editor
  • Asset Sources
  • Editor Section
  • Base/Control Section
  • Game Section
  • UI Section
  • Templates Section

Features

  • Schematics
  • Dialogue Importer
  • Schematic Nodes
  • Formula Nodes
  • Languages
  • Input Keys
  • Audio and Music
  • Game States
  • Pooling
  • Saving Game Objects
  • Scene Objects
  • Save Games
  • Variables
  • Selected Data

Machines

  • Machine Components Overview
  • Animation Machine
  • Animation State Machine
  • Application Machine
  • Auto Machine
  • Collision Machine
  • Global Machine
  • Interaction Machine
  • Render Machine
  • Tagged Machine
  • Template Machine
  • Tick Machine
  • Trigger Machine

UI System

  • UI System Overview
  • UI Layers
  • UI Layouts
  • UI Boxes
  • HUDs
  • Flying Texts
  • Text Codes
  • Unity UI Module
  • HUDs: Content Providers
  • HUDs: Conditions
  • HUDs: Click Actions

Scripting

  • Scripting Overview
  • Code Extensions
  • Custom Save Data
  • Custom Component Save Data
  • Custom Nodes
  • Starting a Schematic

Advanced Topics

  • Build Troubleshooting
  • Performance Optimizations
  • Home
  • Guide
  • Documentation
  • Machines
  • Collision Machine

Collision Machine

Table of Contents
  • Start Types
    • Collision Enter
      • Local Start Variables
      • Additional Start Conditions
      • Example
    • Collision Stay
      • Local Start Variables
      • Additional Start Conditions
      • Example
    • Collision Exit
      • Local Start Variables
      • Additional Start Conditions
      • Example
    • Particle Collision
      • Additional Start Conditions
      • Example
    • Controller Collider Hit
      • Local Start Variables
      • Additional Start Conditions
      • Example

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.

Start Types #

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.

Collision Enter #

Started when another game object starts colliding with the machine’s game object. It’s implemented in the component’s OnCollisionEnter and OnCollisionEnter2D functions.

Local Start Variables #

This start type will automatically initialize the following local variables.

  • relativeVelocity (Vector3)
    Stores the relative linear velocity of the two game objects.
  • normal (Vector3 list)
    Stores the normals of the contact points.
  • point (Vector3 list)
    Stores the points (positions) of the contact points.

Additional Start Conditions #

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.

Example #

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.

Collision Stay #

Started while another game object continues colliding with the machine’s game object. It’s implemented in the component’s OnCollisionStay and OnCollisionStay2D functions.

Local Start Variables #

This start type will automatically initialize the following local variables.

  • relativeVelocity (Vector3)
    Stores the relative linear velocity of the two game objects.
  • normal (Vector3 list)
    Stores the normals of the contact points.
  • point (Vector3 list)
    Stores the points (positions) of the contact points.

Additional Start Conditions #

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.

Example #

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.

Collision Exit #

Started when another game object stops colliding with the machine’s game object. It’s implemented in the component’s OnCollisionExit and OnCollisionExit2D functions.

Local Start Variables #

This start type will automatically initialize the following local variables.

  • relativeVelocity (Vector3)
    Stores the relative linear velocity of the two game objects.
  • normal (Vector3 list)
    Stores the normals of the contact points.
  • point (Vector3 list)
    Stores the points (positions) of the contact points.

Additional Start Conditions #

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.

Example #

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.

Particle Collision #

Started when a particle collides with the machine’s game object. It’s implemented in the component’s OnParticleCollision function.

Additional Start Conditions #

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.

Example #

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.

Controller Collider Hit #

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.

Local Start Variables #

This start type will automatically initialize the following local variables.

  • moveLength (float)
    Stores how far the character controller has traveled before colliding.
  • moveDirection (Vector3)
    Stores direction the characer controller was moving in when colliding.
  • normal (Vector3)
    Stores the normal of collision point.
  • point (Vector3)
    Stores the collision point (position).

Additional Start Conditions #

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.

Example #

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.

Machines
Share This Article :
  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
Updated on December 16, 2020
Table of Contents
  • Start Types
    • Collision Enter
      • Local Start Variables
      • Additional Start Conditions
      • Example
    • Collision Stay
      • Local Start Variables
      • Additional Start Conditions
      • Example
    • Collision Exit
      • Local Start Variables
      • Additional Start Conditions
      • Example
    • Particle Collision
      • Additional Start Conditions
      • Example
    • Controller Collider Hit
      • Local Start Variables
      • Additional Start Conditions
      • Example
Sitemap
  • Features
  • Showcase
  • Guide
    • Documentation
    • Tutorials
    • Extensions
    • API
  • Makinom 1 Hub
    • Tutorials
    • Plugins
    • API
  • Support
  • Forum
  • Get Makinom
  • Contact
  • Blog
  • ORK Framework
  • gamingislove.com
Categories
  • Makinom 1 (97)
    • Tutorial (97)
      • 2D Platformer (14)
      • 2D Roguelike (8)
      • Breakout (6)
      • How-to (34)
      • Match 3 (6)
      • Schematic (4)
      • Scripting (6)
      • Space Shooter (11)
      • Survival Shooter (8)
  • News (11)
  • Release (68)
Search

© 2015 Gaming is Love e.U.

Disclosure: This site may contain affiliate links, which means I may receive a commission if you click a link and purchase something that I have recommended. While clicking these links won’t cost you any money, they will help me fund my development projects while recommending great assets!