from the title
when my player falls any substantial distance their speed goes high enough that they end up inside the ground briefly and visibly, before popping back up to ground level.
this looks like crap and i don’t want it to do that. the way i got around this in Game Maker Studio was by detecting if a collision /would/ take place then looping that check for however many pixels until it was no longer true, stopping cleanly on the ground.
with a float for position, i don’t think this is doable but is there a way to replicate this kind of solution or a better way within unity?
looks like i found a potential solution in this video series from unity:
(part 3)
There’s no need for a “potential solution”, you simply need to understand the difference between Discrete collision detection (fast) and Continuous collision detection (slower).
Continuous stops at the point of impact but the calculations cost a lot more which is why it’s not on by default. It’s a simple selection on any Rigidbody2D in the inspector.
The video above is showing you how to write a movement controller, it’s not related at all and it’s not related to floats or anything else.
1 Like
it does in fact appear to solve the issue in the video with the Rigidbody2D.Cast function around 2:20 unless there’s some kind of communication wires crossed here but thanks for the much easier fix
my (likely common) implementation of GameMaker’s meeting_place used a while loop to iterate through a small number of integers (because 2d coordinates were in pixel integers) in a single frame to achieve a similar result to continuous collision detection. intuitively, iterating a loop through floating point numbers sounds like something to be avoided but i might be wrong.