About Store Forum Documentation Contact



Post Reply 
More precision to pathfinder.
Author Message
cmontiel Offline
Member

Post: #1
More precision to pathfinder.
Since I am having issues with pathfinder at ramps (confirmed in pathfinder tutorial, EE 1.0 and 2.0), I did an algorithm to give more precision:

Code:
Game::Chr::actionMoveTo(pos);
Int precision = 2;

for(Int x = 0; x< precision; x++)
        {
            if(path.elms()>1)
            {
                Int tocheck = path.elms()-1;
                Int index = 0;
                FREP(tocheck)
                {
                    Vec midpoint = (path[index] + path[index+1]) / 2.f;
                    Vec surface_pos;
                    if(Game::World.path().nearestSurface(midpoint, Vec(0.9f,0.9f,0.9f), surface_pos))
                    {
                        path.NewAt(index+1) = surface_pos;
                        index+=2;
                    }
                    else
                    {
                        index++;
                    }
                }
            }
        }
(This post was last modified: 10-18-2013 01:59 PM by cmontiel.)
10-17-2013 01:34 AM
Find all posts by this user Quote this message in a reply
Post Reply