ceeed Posted May 19, 2017 Share Posted May 19, 2017 Hey guys, i'm trying to implement hitboxes with p2 physics. I all ready have a solution, but i find it kind of awkward. What i want to do is create a sprite, and attach multiple p2 bodies to it, the main body is the players hitbox which is just a normal polygon body. the other bodies are all set up as sensors so the don't mess with physics but still trigger the collide. I tried adding multiple sprites as childs with their own bodies, but that wont work. Has anyone done this before, or do i have to digg in deep? cheers ps: my current solution is creating sprites that are not linked together in any way, and than moving them all to the players position. laggy as hell Link to comment Share on other sites More sharing options...
ceeed Posted May 20, 2017 Author Share Posted May 20, 2017 found a solution player being the player sprite hitbox being the hitbox sprite hitbox.body.mass 0.00001; game.physics.p2.createLockConstraint(, hitbox, [0, 0], 0, 9999); i have some stuff set by default to all objects, so you might have to fiddle a bit to get it work. but this is way more fluid then the tracking method Link to comment Share on other sites More sharing options...
Recommended Posts