How to find where to cast a ray to avoid collision in Bullet?

前端 未结 5 953
一整个雨季
一整个雨季 2020-12-15 12:34

Say we have an object at point A. It wants to find out if it can move to point B. It has limited velocity so it can only move step by step. It casts a ray at direction it is

5条回答
  •  清歌不尽
    2020-12-15 12:42

    How about a simple approach to begin with....

    If this is just one object, you could compute the convex hull of all the vertices of the obstacle, plus the start and end points. You would then examine the two directions to get from A to B by traversing the hull clockwise and anti-clockwise. Choose the shortest path.

    It's a little more complex because the shape you are moving is not just a point. You can't just blindly move its centre or it will collide. It gets more complicated still as it moves past a vertex, because you have to graze an edge of your object against the vertex of the obstacle.

    But hopefully that gives you an idea to ponder over, that's not conceptually difficult to understand.

提交回复
热议问题