Resolving collisions with HardonCollider

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Resolving collisions with HardonCollider

Post by kikito »

davisdude wrote:To solve this, couldn't you just make a line segment from the current point to the predicted next point for each object, and check if those segments intersect? If I understand correctly, that would solve this problem.
Yes, you understood correctly. It is possible. My comment was not that it was impossible, but that it was too much complexity for very little gain, at least on my mind.

A rough list of what's needed:

You must start by "dividing time into frames". You need one method in your "world" which says "a new frame is starting now". You then draw "where all the objects are going" (the segment you mention), in a "physics canvas". On each frame, the canvas is erased.

When you check an object for collisions, you look at the "canvas" to see who it collides with.

Implementing this "canvas" is more complex than when one of the objects is always static. Not only you need a new "intermediate structure". You also need to take into account some picky edge cases: ¿Do you "redraw" parts of the canvas, as the objects "bounce around"?. ¿What happens when A pushes B, B pushes C, and C pushes A again, in the same frame?.

The api gets also more complex. You have extra method that the users have to remember calling (the "A new frame starts" method), and if he doesn't, "phantoms" from previous frames will collide with his objects, but no error will be raised. It also adds complexity on the resolution: Instead of a single displacement vector for a single moving object, you need two.

I personally think it is not worth it.
When I write def I mean function.
User avatar
Suspicious_37
Prole
Posts: 10
Joined: Tue Oct 16, 2012 12:22 pm
Location: Australia
Contact:

Re: Resolving collisions with HardonCollider

Post by Suspicious_37 »

Im having the exact same issue too. Every time the player is shape_b it does this same issue. how do you recomened fixing it because the shape_b:move(-mtv_x, -mtv_y) didn't work for me?
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest