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 Manic

Is there a plugin or anything to define a polygon hitbox based on an entity's image alpha? I don't want to have to define Box2D hitboxes for a simple shooting game, and would love to see hitboxes that aren't scaled exactly to an entity. For instance, one of the enemies in a game I'm working on is a giant spider--all legs with a small body. Clearly the whole image (with a ton of alpha in it, for all of the empty space around the legs, since the body is fat and takes up that much width but is high up) is too big a hitbox. Bullets disappear a good second before they actually hit the spider, since they hit the other bit first.

How do I make it so that the hitbox is built by the alpha, not the bounding box of the image?

1 decade ago by Joncom

I am not aware of a pre-existing plugin that does this, however it sounds very possible. If you're feeling up to making the plugin yourself, here's an algorithm that may be helpful in doing so.

Edit: My bad, I thought you were planning to use Box2D. Must have been tired when I read your post... >.<

1 decade ago by Xatruch

http://impactjs.com/forums/code/per-pixel-collision-detection-plugin
Page 1 of 1
« first « previous next › last »