Sunday, October 16, 2022
HomeGame Developmentunity - agent.rework.place by no means equals agent.transsform.vacation spot, regardless that agent...

unity – agent.rework.place by no means equals agent.transsform.vacation spot, regardless that agent stops shifting


I’ve set my agent vacation spot utilizing this line:

selectedGameObject.GetComponent<NavMeshAgent>().vacation spot = rightClickHit.level - new Vector3(2, 0, 2);

Then, I am checking to see when the agent reaches the vacation spot by this line:

if (selectedGameObject.rework.place == rightClickHit.level - new Vector3(2, selectedGameObject.rework.place.y, 2))

I’ve debugged it and know the agent does attain the vacation spot with the offset

enter image description here

However the situation by no means resolves to true. Is it presumably off by decimal locations past 2? The agent does seem to cease shifting when it reaches the goal offset.

Go simple on me. It is solely my second week of coding.
Tim

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments