Jump to content

Problem with path route. agents stuck.


photo

Recommended Posts

Hello.

 

I face 2 problems.

 

 

The first one is that sometimes the agents stuck in the corners.

 

Path before stucking:

post-624-0-79058700-1337605066_thumb.jpg

 

After stucking

Front: post-624-0-26365500-1337605067_thumb.jpg

 

Top: post-624-0-68501200-1337605067_thumb.jpg

 

 

 

 

The cylinder's radius is equal with obstacle radius.

Here is the code defining the obstacle.

obstacle = new ObstacleSphere(object_radius);
route = new PathRoute(object_radius);
route.setExcludeObstacles((obstacle));

I have to mention here that in some other cases, the cylinder is out of the navigation mesh.

I guess this shouldn't be happenning.

 

The second problem is that sometimes the agent cannot decide which path to follow to reach the destination.

This happens when it is on the mesh separator (the green line).

It stays there and changes path almost in every frame.

 

post-624-0-03693300-1337605068_thumb.jpg

 

 

IS there any solution ?

 

Thank you.

Link to comment
The second problem is that sometimes the agent cannot decide which path to follow to reach the destination.

First of all, do not calculate the route each frame! In samples it's done purely for stress testing purposes. If you need the agent to react on the changing environment, you can recalculate the path at least once per 10 frames, that'd be enough.

 

You can check prototypes/shooter for an example of pathfinding in a project.

 

The first one is that sometimes the agents stuck in the corners.

It it always gets stuck in this corner, you can add an obstacle for it. Again, I strongly recommend to check Shooter prototype as it might be really helpful.

 

I have to mention here that in some other cases, the cylinder is out of the navigation mesh.

I guess this shouldn't be happenning.

That's strange, because it shouldn't, you are right. You can send a test scene for us so we check it out.

Link to comment

The first one is that sometimes the agents stuck in the corners.

I've consulted our developer who wrote Shooter pathfinding code. He suggests that if the agent gets stuck, you can decrease the obstacle radius radius a bit so he goes through. After that, restore the radius and recalculate the route.

 

Another thing he pointed out, is that most probably you do not move the agent exactly along the calculated route, which causes such behaviour as you've described (getting stuck in the corner, obstacle going out of navigation mesh).

Link to comment

Hello.

 

This is how i do the agent movement:

 

Vec3 route_direction = route.getPoint(1) - route.getPoint(0);
quat orientation = quat(setTo(Vec3_zero,route_direction,vec3(0.0f,0.0f,1.0f))); 
route_direction = normalize(route_direction);
position += route_direction * ifps * move_speed;

 

Thank you.

Link to comment

Hello again.

 

Is there any place to download only the shooter demo?

The directory data\prototypes\shooter has only the unigine.cfg.

I have installed the most recent version of unigine.

 

Thnx.

Link to comment
  • 3 weeks later...

This is how i do the agent movement:

 

Vec3 route_direction = route.getPoint(1) - route.getPoint(0);
quat orientation = quat(setTo(Vec3_zero,route_direction,vec3(0.0f,0.0f,1.0f)));
route_direction = normalize(route_direction);
position += route_direction * ifps * move_speed;

The problem is that your agent can end up not exactly in the found destination point.

 

You move an agent from the source point to the found destination point with a fixed step. However, in reality the last step the agent makes can be too short or too long to reach this point. And if it is too long, the agent goes outside the navigation area, though the pathfinding module found the proper destination point.

 

To improve the situation, check if last step ends up exactly in the destination point position.

Link to comment
×
×
  • Create New...