Timeline for Platformer raycast collision detection
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 3, 2014 at 19:52 | history | edited | Victor T. | CC BY-SA 3.0 |
added 328 characters in body
|
Mar 3, 2014 at 19:48 | comment | added | General Waters | Yep, and I added a small amount of "skin space" between the layer and sprite to give a small space to prevent some snagging. Cool! Look forward to it. | |
Mar 3, 2014 at 19:47 | comment | added | Victor T. | Oops, I didn't fully consider upward movement! Also, there's a further simplification you can make. I'll edit my answer. | |
Mar 3, 2014 at 19:36 | vote | accept | General Waters | ||
Mar 3, 2014 at 19:35 | comment | added | General Waters |
Ah yes, this makes complete sense. The final solution ends up being float y = Mathf.Sign(deltaY) == -1 ? _collisionRect.yMin : _collisionRect.yMax; // Give a small amount of skin space to prevent snagging. float skinSpace = 0.005f; deltaY = (_collisionRect.center.y + hit.distance * ray.direction.y - y) + skinSpace;
|
|
Mar 3, 2014 at 18:32 | history | answered | Victor T. | CC BY-SA 3.0 |