I'm having a problem with AI movement in my top-down game. AI builds path and than moves using libgdx FollowPath (this problem is still actual) steering behavior. I have some solutions, but can't guess whitch is better(or I even need other solution). FollowPath params:
followp = new FollowPath<Vector2, LinePathParam>(this, new LinePath<Vector2>(path)); followp.setPredictionTime(0.08f); followp.setArriveEnabled(true); followp.setArrivalTolerance(0.001f); followp.setDecelerationRadius(40f); followp.setTimeToTarget(0.1f);
Problem. Character doesn't move straightly according to the path - cuts corners through obstacles. Solution 1. Find right proportion between character speed/acceleration, character size, obstacles size. Curent parameters: maxLinearSpeed = 100; maxLinearAcceleration = 150; maxAngularSpeed = 15; maxAngularAcceleration = 30; characterRadius=40; obstacleSize=120 (width and height). But if acceleration and speed are too big, character will move like "on rails" and even sticks on corners. Too small - character will be skidding.
Solution 2. Write own FollowPath steering behavior, whitch requires character to get close enough to every point of the path (without using predictionTime,that prevents sticking, but allows cutting corners) and using Arrive on every point of the path, that won't allow skidding.
Solution 3. Use RaycastObstacleAvoidance with FollowPath together(Priority steering). Here comes another problem: cause of raycasting character shakes (especially when it needs to turn around near wall or just target is near wall). Probably, it is solved by usage of lower angular acceleration (causes skidding).