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 papyhardcore

Hi,
I have a problem with collisions.
I create an entity 16 * 16 which is my player.
link
I create a layer with TileSize = 16.
image
My player fails to pass between two blocks.
image

I do not understand why.

Thx for help.

1 decade ago by Joncom

Let's see your entire player.js file please.

1 decade ago by papyhardcore

Hi,
My player.js file :
link

1 decade ago by dominic

The .pos.x/y in Impact is a floating point number. It's not rounded or truncated for physics calculations. So what you're seeing is an entity that's never perfectly aligned to fit between those two blocks.

E.g. lets assume you have two tiles at the following y coordinates 32 and 48. Now, if the entity&039;s y position is *exactly* #32, it will fit in between those blocks. This only work in theory, because the entity&039;s position might be #32.0003235 or something similar, but not quite exactly 32.

Long story short: make your entity smaller. 14x14 maybe. Give it an offset of {x:1, y:1} to center the image on it.
Page 1 of 1
« first « previous next › last »