By default, all objects have this meta-component.
The Object Component has only 2 options that determine how this object can interact with others in a Hype.
Group | Determines which object groups this object belongs to. There are 10 color coded object groups to use and any object can belong to multiple groups. |
Reference Object | Changes the object into an instanceable object, which can be used in other components but won’t appear in the world itself. |
Object Groups are most commonly used by Collision Triggers so we'll set up a basic collision trigger for this example. For this set-up we have two assets already prepared:
Commonly we use the Green group to identify a playable character when making pre-made addons and assets so we'll select Green group here as our ball represents our playable character. We'll also deselect the default Grey group so that this ball is only in the Green group.
This is where the object group is important. By setting the Trigger With Group to be Red we are telling the Collision Trigger to only activate if it comes into contact with objects in the Red group. If contact is made with objects in any of the other color groups, this trigger will not activate.
We've already set our Collision Trigger to activate on Red group so that's what we'll set the box to be.
If everything is set-up correctly our ball will drop and explode when it hits the box.
Reference Objects are commonly used with Spawners or Instanced Containers. To demonstrate we'll take the previous example and change it so that the ball is emitted from a Spawner instead of just dropping from the sky at the start.
For the set-up we have the ball and box that we set up in the previous example. The ball has a few components that cause it to explode if it touches the box.
For this example we'll need an Interval trigger to activate the Spawner in order to test the action. For testing purposes we'll set it up to continually spawn new balls once every second.
Now when we test the original ball will no longer be visible and balls will emit from the Spawner once every second. Had we not made the ball a reference object the Spawner would still be able to emit it however the original ball would still be visible and behave normally. Once the original ball falls and is destroyed the Spawner no longer has an object to emit so it will stop spawning new balls.