Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This is a snippet of my controller code - basically newh and newv replace the standard stick inputs
- // - so instead of trying to relative to the stick, it's pointing to the mouse arrow
- Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
- Plane playerPlane = new Plane(Vector3.up, transform.position);
- float hitdist = 0f;
- if (playerPlane.Raycast (ray,out hitdist)) {
- Vector3 targetPoint = ray.GetPoint(hitdist);
- targetPoint=(targetPoint-transform.position).normalized;
- newh=targetPoint.x;
- newv=targetPoint.z;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement