About Store Forum Documentation Contact



Post Reply 
Wall Detection
Author Message
jakotheshadows Offline
Member

Post: #1
Wall Detection
So I have an AI chr and I want it to be peaceful and run away from an orb of light that is in the game. The problem is right now it keeps running into walls and doesn't really try to get away from the Orb.

if(Dist(pos(), PlayerOrb.matrix.pos) > 10)
actionBreak();
else
{
if(Physics.ray(pos(), Matrix().z))
direction.chs();
moveTo(direction);
}

PlayerOrb is the object I want the NPC to run from, and it will "feel safe" and stop at a distance greater than 10. With the Physics.ray() call I'm trying to determine if the NPC is running into a wall, and to run in the opposite direction. moveTo actually just calls actionMoveDir(direction).

Any thoughts on how to better detect walls?
12-05-2012 03:31 AM
Find all posts by this user Quote this message in a reply
Ogniok Offline
Member

Post: #2
RE: Wall Detection
Why can't you just use built-in pathfinding? Just randomize a position over 10 meters from player orb and then call moveTo(POSITION).
12-10-2012 04:42 PM
Find all posts by this user Quote this message in a reply
Post Reply