- Home /
Move waypoint mouse click
I have a player with a child as a waypoint. My camera is a topdown camera (i would like for it to be pointing down at 45 degrees but i figure ill deal with that later). The problem is when i click down the waypoint is very jumpy and doesnt usualy move to where i want untill i click twice. any idea on how i could fix this? Thanks in advance
here is my code
function Update () { if (Input.GetButtonDown ("Fire1")) { var mousePos = Input.mousePosition; mousePos.z = 15;
var objectPos = camera.main.ScreenToWorldPoint(mousePos);
gameObject.transform.position = Vector3(objectPos.x, objectPos.y, objectPos.z);
transform.root.gameObject.SendMessage ("Move");
}
}
I think you need to show us the move script, that is possibly where your problem lies.
Your answer
Follow this Question
Related Questions
Need help getting my character to move 2 Answers
Random location when clicked on 1 Answer
How can I do the character parallel to geometry level 1 Answer
Character - what collider? 2 Answers
Tilt movement with Unity Android 1 Answer