Home Game Development unity – agent.remodel.place by no means equals agent.transsform.vacation spot, regardless that agent stops shifting

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

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

[ad_1]

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

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

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

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

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

enter image description here

But 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 straightforward on me. It’s solely my second week of coding.
Tim

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here