POINTER SCRIPT
SCRIPT NEEDS TO ACCOMPLISH...
Script Communication <Singleton>
Cast raycast with mouse left click
Check if "Floor" was hit
Set target destination (tell player object to move here)
LINE 5 --> finds the player script by using FindObjectOfType which searches assets by type <Script Name Player> and assigns it to the variable _player
LINE 8-23 --> Placing raycast knowledge within the update method so the program listens for the mouse click from the user each frame
LINE 10-22 --> if statement to define function for left mouse click
LINE 12 --> Defines the starting point of the ray [rayOrigin]
LINE 13 --> Structure used to get information back from a raycast collision [RaycastHit]
LINE 15-21 --> if statement to define functions to run when raycast collides with an object
LINE 17-20 --> if statement to push the point of intersection [targetDestination] to the player script if the user clicks on the floor
Last updated