Anchors
Anchors enable specific actions for players upon reaching designated points in the environment, such as sitting down, standing up, or other actions.
Creating an Anchor
To create an anchor, follow these steps:
- Right-click in the
Hierarchy
window and selectCreate Empty
. - Rename the new object to
Anchor
. - Add an
Anchor
component to the object by clickingAdd Component
in theInspector
. - Specify the desired
Action
for the anchor. - Attach a
Tap Handler
component to make the anchor interactive. - Include a
Collider
component to trigger the anchor.
An object must have both a
Collider
component and aTap Handler
component for the Anchor to function properly.
Anchor Actions
Anchors support the following actions:
- Sit: Player sits down upon reaching the anchor.
- Stand: Player stands up upon reaching the anchor.
- Run: Player runs in place upon reaching the anchor.
- Walk: Player walks in place upon reaching the anchor.
Anchor Properties
Anchors have the following properties:
- Animation: The animation to play when the player reaches the anchor.
- Tappable: Whether the anchor is tappable by the player.
- Enter From: The direction from which the player enters the anchor.
- Exit To: The direction to which the player exits the anchor.
Anchors can be set to any game object in the environment, whether it is an empty object or a 3D model.
Anchor Examples
Here are some examples of how anchors can be used in a scene:
- Sitting Area: Create an anchor that allows the player to sit down on a bench.
- Running Track: Create an anchor that allows the player to run in place on a treadmill.
- Walking Path: Create an anchor that allows the player to walk in place along a path.
Conclusion
Anchors are a powerful tool for creating interactive experiences in the environment. By using anchors, you can add a new level of engagement and immersion to your scene.