Hi all
I'd like to find clicked point on my mesh.I wrote code:
void OnMouseUp()
{
RaycastHit hit;
if(Physics.Raycast(Input.mousePosition,transform.position,out hit))
{
infoText.text="hit on:"+hit.point.ToString();
}
}
well,it works but it gives me coords in world space,not mesh ones :/
I read docs,make research on this forum,ask few questions and find out that such shoud convert world's hitpoint coordinates into mesh local:
infoText.text="hit on:"+transform.InverseTransformPoint(hit.point).ToString();
But this gives me unacceptable results-if I move my mouse cursor about a centimeter in any direction I still get the same coordinates :/ Such issue does not appear if I check the point in world's space-change mouse position even a milimeter is noticeable and gives other point coords.
Who knows what can cause the issue?
↧