i am using box2d to implement a "worms like" rope mechanic and have a question.
A rough explanation of my problem can be seen in the following animation.
The left animation runs at a high frame rate and my current algorithm works in this specific case, but on the right you can see that at a lower frame rate it fails.
I have the player connected to the level by a distant joint and am firing raycasts from the players position to the connection point each frame to find intersections. If the raycast hits something, i am creating a new joint at that point and save the previous connection point along with the angle of the rope. If i pass the angle again in the other direction i remove the last joint and reconnect to the previous point. The level is a static body with a list of shape fixtures.
This works only if i add a threshold to the angle when i pass it in the other direction, otherwise it would instantly find a new intersection point with the next raycast.
I need to find the right point where the new joint should be connected.
My question now is what would be the most efficient method to find the right point and can box2d help me with that?
My first approach would be to find all points within the triangle ABC and then find the nearest point to the line BC. but i really don’t know how to find those points efficiently.
Can someone push me in the right direction?
Thank you very much.
Here's the place to get help and discuss features. The focus is on the C++ version, but generic questions are welcome.
1 post • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest