Replies: 2 comments 1 reply
-
@jaredegan I've taken a look, I'm able to reproduce this behavior when the floor collider is smaller width than the player collider width. Appears to be a bug in the currently released Excalibur collision implementation. I think this is the culprit, instead of resolving position immediately after each pair, each collision is calculated then resolved, which allows multiple collisions to queue up that might no need to happen if the first was resolved. https://github.com/excaliburjs/Excalibur/blob/main/src/engine/Scene.ts#L382-L384 One wide actor, custom tiling draw let platformX = engine.halfDrawWidth + 50;
for (let i = 0; i < 1; i++) {
// 1 actor for 10 floor tiles
const f = new Floor(platformX, 200, 10, 1);
engine.add(f);
platformX += 8;
} Actor per tile let platformX = engine.halfDrawWidth + 50;
for (let i = 0; i < 10; i++) {
const f = new Floor(platformX, 200, 1, 1);
engine.add(f);
platformX += 8;
} We are working on some improvements to the collision systems that I believe will eliminate this behavior (I will confirm that though) because the resolution takes into account collider separation at every velocity/position resolution step.
Unfortunately v0.25 is also coming with a few bigger changes in addition to the collision simulation improvements. Potential workarounds/solutions
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the thoughtful and very thorough response! I should be able to make one of these workarounds work, and I'll look forward to 0.25. This is very much a hobby project / prototype so it may be a few days before I can give it a shot. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I've been playing around with Excalibur, building off of the "sample-platformer" repo. That project has a
Floor
actor that draws rectangles and has big rectangular based Box colliders, and that floor works well for a platformer.I added the ability to define a level based off of text to act as a quick level editor to tide me over before trying out something better like Tiled. So my code would take an array like this:
And loop over it like this:
So my world will be built of 8x8 blocks. The floor made one 8x8 actor / collider at a time. The
Floor
class is essentially unchanged from the demo project.The result is the attached gif. When my player walks along colliders constructed in this way, this jitter happens. There is some idle animation in that gif, but you can tell what I mean by the jitter. This jitter doesn't happen if I make the floor as the "sample-platformer" code had it. I assume this is the "odd oscillating behavior" mentioned in https://excaliburjs.com/docs/physics#limitations
Do you have any recommendations for me? If I make my floors / walls as bigger, continuous colliders, will that be a good strategy? What if my player is in a corner of a wall & a floor?
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions