Hey there,
In the game I'm working on at the moment, the field is constructed of hexagons, some of which are solid and impassable. I notice something weird when colliding with the corner in between two hexagons, in that it leaves a little gap. After some experimentation, I found that it has something to do with the acceleration of the object, because an exact replica of the object minus the acceleration doesn't have the issue.
I'm having this issue with the Hardon Collider, but I also encountered this program when I coded up an SAT algorithm myself.
Is this just the nature of the beast with 2d collisions? Any good way to resolve this? It's not major, but I thought I'd see if anyone knows how to fix the problem
White is the circle with acceleration, red is without. Note the tiny gap on the left.
It's worth noting that the gap goes away when you stop trying to walk into the corner, it smoothly transitions into it as well, quite odd.
Hardon Collider and Acceleration leaves weird gap
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Hardon Collider and Acceleration leaves weird gap
- Attachments
-
- HCaccelerationweirdness.love
- (37.65 KiB) Downloaded 90 times
Re: Hardon Collider and Acceleration leaves weird gap
What's happening is that the sum of the individual separating vectors does not give you the correct separating vector for the collision with both shapes at the same time. HC is not able to give you that.
Your implementation of acceleration makes the shape keep its inertia even after the collision has been resolved, rather than stopping it dead or bouncing. As a consequence, you're approaching the shapes in smaller increments after the key release, which makes the error of the individual separating vectors vs the actual separating vector smaller. That's why it ends up at a point closer to the right position than doing one whole step at a time.
So, one approximate solution would be to perform the approach in several steps, resolving collisions at each step.
Your implementation of acceleration makes the shape keep its inertia even after the collision has been resolved, rather than stopping it dead or bouncing. As a consequence, you're approaching the shapes in smaller increments after the key release, which makes the error of the individual separating vectors vs the actual separating vector smaller. That's why it ends up at a point closer to the right position than doing one whole step at a time.
So, one approximate solution would be to perform the approach in several steps, resolving collisions at each step.
Who is online
Users browsing this forum: Amazon [Bot], Google [Bot] and 5 guests