public void ResetTarget() { if (Target != null) { float[] endPos = { Target.transform.position.x, Target.transform.position.y, Target.transform.position.z }; long endRef = 0; float[] nearestPt = new float[3]; _navMeshQuery.FindNearestPoly(endPos, new[] { 2f, 4f, 2f }, filter, ref endRef, ref nearestPt); crowd.RequestMoveTarget(AgentId, endRef, nearestPt); targetPos = Target.transform.position; } }
public void Move(Vector3 dest) { if (_enabled) { float[] endPos = new float[3] { dest.x, dest.y, dest.z }; long endRef = 0; float[] nearestPt = new float[3]; _navMeshQuery.FindNearestPoly(endPos, new[] { 2f, 4f, 2f }, filter, ref endRef, ref nearestPt); crowd.RequestMoveTarget(AgentId, endRef, nearestPt); targetPos = dest; } }
public void Move(Vector3 dest) { if (_enabled) { float[] endPos = new float[3] { dest.x, dest.y, dest.z }; long endRef = 0; float[] nearestPt = new float[3]; Status status = _navMeshQuery.FindNearestPoly(endPos, new[] { 2f, 4f, 2f }, filter, ref endRef, ref nearestPt); if (status == Status.Success) { crowd.RequestMoveTarget(AgentId, endRef, nearestPt); } _startMove = true; } }