Hi! I am trying to get closest node to a position from Ray hit.My ray hit point which is targetPos here is :(20.4, 2.0, -4.4) but what I am getting from targetNode is (19689.0, 0.0, -4500.0) .What is the problem here???
GraphNode currNode = AstarPath.active.GetNearest (tr.position, NNConstraint.Default).node;
GraphNode targetNode = AstarPath.active.GetNearest (targetPos, NNConstraint.Default).node;
Debug.Log("TARGET NODE POS IS :"+ targetNode.position.ToString());
Hi
Node.position is an Int3, not a Vector3. You can cast it to a Vector3 to get the world coordinate.
Vector3 worldPosition = (Vector3)node.position;
Int3 coordinates are usually 1000 times larger than the Vector3 representation of it.