How do I find a point along a line with a forced x and z values
I'm having trouble getting my Aim Target to the red star location. I'm aware that the magnitude of defaultAimVec isn't long enough to get to the star position but it's escaping me how to get the correct distance along aimVec with the given information. Thanks for the help.
Debug.DrawLine(transform.position, lookPos, Color.white); Vector3 aimVec = lookPos - transform.position; Vector3 defaultAimVec = defaultTarget.position - transform.position; Debug.DrawLine(defaultTarget.position, transform.position, Color.yellow); Vector3 newYPos = aimVec.normalized * defaultAimVec.magnitude; Debug.DrawLine(defaultTarget.position, transform.position + newYPos, Color.magenta); aimTarget.position = new Vector3(defaultTarget.position.x, (transform.position + newYPos).y, defaultTarget.position.z);
using the items in your screenshot, can you clarify what you know and what you want to find ?