Created
February 18, 2022 11:25
-
-
Save partiallyblind/24739521b0f8bdd33703fe1c5595a0eb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class ClickSetPosition : MonoBehaviour | |
{ | |
public PropertiesAndCoroutines coroutineScript; | |
void OnMouseDown () | |
{ | |
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); | |
RaycastHit hit; | |
Physics.Raycast(ray, out hit); | |
if(hit.collider.gameObject == gameObject) | |
{ | |
Vector3 newTarget = hit.point + new Vector3(0, 0.5f, 0); | |
coroutineScript.Target = newTarget; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment