In short, when the player clicks the primary mouse button, a raycast is cast from the center of the screen. If the raycast hits a collider, it creates a reference to that objects transform. it then sends a message to the script attached to the transform with the name of a funtion. In this case its "Operate". When this happens, it executes the function and this is how we interact with objects!
Thursday, November 10, 2016
Explaining the Device Operator
In this video, I explain how the player is able to interact with any of the objects in the scene that have the ability to be interacted with. This is done using a script with an "Operate" function.
In short, when the player clicks the primary mouse button, a raycast is cast from the center of the screen. If the raycast hits a collider, it creates a reference to that objects transform. it then sends a message to the script attached to the transform with the name of a funtion. In this case its "Operate". When this happens, it executes the function and this is how we interact with objects!
In short, when the player clicks the primary mouse button, a raycast is cast from the center of the screen. If the raycast hits a collider, it creates a reference to that objects transform. it then sends a message to the script attached to the transform with the name of a funtion. In this case its "Operate". When this happens, it executes the function and this is how we interact with objects!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment