Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by craig132

if (overlapY > overlapX || ( bottom.grounded && top.collides === ig.EntityExtended.COLLIDES.FIXED )) {

// two fixed entities collided

if ( left.collides + right.collides >= COLLISION_DOUBLEFIXED ) {

left.collideWith(right, 1, 0, -overlapX, 0);
right.collideWith(left, -1, 0, overlapX, 0);

}
else {

vel = (left.vel.x - right.vel.x) * 0.5;

left.collideWith(right, 1, 0, -overlapX, -vel, weak);
right.collideWith(left, -1, 0, overlapX, vel, weak);

}

}
// default to higher overlap on x axis, i.e. vertical collision
else {

// two fixed entities collided

if ( top.collides + bottom.collides >= COLLISION_DOUBLEFIXED ) {

top.collideWith(bottom, 0, 1, -overlapY, 0);
bottom.collideWith(top, 0, -1, overlapY, 0);

}
else {
//bug occurs here, -1 case doesn't trigger
vel = (top.vel.y - bottom.vel.y) * 0.5;

top.collideWith(bottom, 0, 1, -overlapY, -vel, weak);
bottom.collideWith(top, 0, -1, overlapY, vel, weak);

}

}

I am using the impact++ plugins to make a birds eye view game.
The horizontal collision with fixed entity is working fine, weak one stops at collision. Vertical collision seems to be broken. Collision with fixed entity below character is fine, but collision with fixed entity above character causes the character to teleport to the side of the fixed entity. Any help is appreciated.

1 decade ago by Joncom

Please share your entire entity JavaScripts. When posting them, please enclose them in ## for proper formatting. See the "Show Formatting Help" link for more info.
Page 1 of 1
« first « previous next › last »