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 Joncom

According to the .trace documentation:

{
    collision: { x: false, y: false, slope: false },
    pos: { x: 0, y: 0 }, // Resulting object position
    tile: { x: 0, y: 0 } // Tile for the collision
}

It returns a piece of information called "tile" which is the "tile for the collision".

But what does that mean?

I would guess that it's the position of the very first tile which triggers a collision response. However, my tests don't seem to suggest this at all.

Does anyone know what it's actually for?

1 decade ago by Joncom

OK. I think I figured out what it does.

If you collide with something on the x-axis, then res.collision.x will be true, and res.tile.x will be the collision tile type (nothing to do with game world position). For example, a standard solid "wall" collision tile is always represented by a 1.

And if res.collision.x == false, then res.tile.x will be 0.

Same goes for y.
Page 1 of 1
« first « previous next › last »