Created
October 14, 2016 15:25
-
-
Save Sammyjroberts/ae2aac0baff9758e0c0432cd35179bb6 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
void Update() { | |
if(Input.GetMouseButton(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; | |
Vector3 bottom = transform.position; | |
bottom.y=0.1f; | |
Vector3 floorHitfix = floorHit.point; | |
floorHitfix.y = 0.1f; | |
r.SetPosition(0, bottom); | |
r.SetPosition(1, floorHitfix); | |
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