NPC movement with OgreNewt

simdevode

24-10-2006 03:25:23

I've been trying to get my NPCs to walk for quite sometime now though with no luck. While the logic behind moving bodies should be no different for NPCs -- I'm stuck with having able to stop them just at the right location. Basically, I am doing a setVelocity in the direction of my destination and doing a getPosOrient on every frame to check if the NPC's current location matches the destination. But the NPC's position never exactly matches my destination vector. Am I missing something here?

Thanks!

nikhil

24-10-2006 10:32:19

Don't check for equality, check for <= or >= i.e vicintiy. Comparisions with floats can be weird.