Jump to content

p2 detect collision from one side


1ipt0n
 Share

Recommended Posts

Hi,
Im trying to detect collision in p2 from one side (like jumping on top of something) its easy with arcade phisics, but p2 don't have such option, i think.
 
So is there any way to implement this?
 
if not than I was thinking about sticking another invisible body to a side of object and detect collision with that second object instead.
But I dont know how to stick other object to first one and I've experimented with RevoluteConstraint to do it but it;s not what I intended.
 
my code:

var constraint = game.physics.p2.createRevoluteConstraint(arrow, [20, 5.5 ], arrowTop, [5.5,5.5]);    constraint.collideConnected=false;    constraint.setStiffness(600);    constraint.update();

but it behave like two objects on elastic  rope so sometimes  arrowTop if closer to arrow and sometimes its further . even if I set more stiffness it's bouncing.
Is there way to stick two bodies like on glue instead of rope ?
whatiwant.png

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...