Created
October 13, 2016 20:24
-
-
Save Sammyjroberts/da40b509f98b09bbf8be1f6ac25d2535 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
void Update() { | |
if(Input.GetMouseButtonDown(0)) { | |
Debug.Log("ok"); | |
Vector3 bottom = GetComponent<CapsuleCollider>().center; | |
Ray camRay = Camera.main.ScreenPointToRay (Input.mousePosition); | |
RaycastHit floorHit; | |
if(Physics.Raycast (camRay, out floorHit, camRayLength, floorMask)) | |
{ | |
Vector3 playerToMouse = floorHit.point - transform.position; | |
r.SetPosition(0, bottom); | |
r.SetPosition(1, floorHit.point); | |
Debug.Log(bottom); | |
Debug.Log(floorHit.point); | |
} | |
} | |
else { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment