Interaction Script

This is a simple script that allows the player to interact with object in the environment such as pickups.

Essentially we have a trigger sphere around our player, when an object is inside this sphere if we hit e, or in this demo’s case the mouse button (Axis can be configured from player settings) we want to do … something to that object. These scripts are written so later on they can be changed, to accommodate more behaviors hence the use of the case statement.

The interaction happens locally within the script attached to the object you collide with “Fire()” is used to start the behavior. Again this is for future proofing when we add more complex behaviors.

As you can see currently the interactions are very simple. but will be expanded later.

Player picking up the item.

Published by Syriph

I am just a person, who wants to be happy. I hope sharing my art and stories will make others happy as well! If you like my work... Thank you! :) please leave a comment or email, I would love to hear any feedback.

Leave a comment

Design a site like this with WordPress.com
Get started