Handmade Hero»Forums»Code
James Hutchinson
1 posts
Day 47 Collision Detection
The new collision detection code (which is not yet finished so this might not be relevant) assumes that the player moves at constant speed on straight lines.

This doesn't seem true to me. In fact we move on a parabola, as seen in the calculation of PlayerDelta.

1
v2 PlayerDelta = (0.5f*ddP*Square(dt) + Entity->dP*dt);

I accept that 0.5 * |ddP| * Square(dt) is much smaller than |dP| * dt so these assumptions are probably fine.

I'm wondering if you had considered this and decided that it was OK? Or have I misunderstood something about the Physics/Code?

It isn't actually too much extra work to solve the quadratic to find the time the straight line is intersected, are the sqrts the reason not to do this?
Mārtiņš Možeiko
2563 posts / 2 projects
Day 47 Collision Detection
I think it doesn't matter. Because movements are so small that you can easily use straight line as approximation of whatever movement happens in one frame.

Also we are checking 3 points for character, so that should be enough to look believable and not introduce glitches. And now it looks we'll have better collision detection anyway than just 3 points.
Kim
Kim Jørgensen
64 posts
Day 47 Collision Detection
Edited by Kim Jørgensen on
Ups, was replying to wrong post!