Sign in to follow this  
1ipt0n

p2 detect collision from one side

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.