Jump to content

Physics with touch to move player


mattbrand
 Share

Recommended Posts

This post is related:

P2 is sophisticated enough I think. You could try arcade physics, but  rotational effects are not considered after collision, so the ball will not spin when colliding with walls (it will in P2, see above post). Arcade physics bodies are always axis aligned, which might be undesirable in your case:

p2:

 

arcade:

https://codepen.io/Samid737/pen/BRKdWK

Link to comment
Share on other sites

I made some serious progress with help from @samme.

Still not sure what to do in onDragUpdate(), where I catch the case where I want to have the ball be released:

if (xDiff > 20.0 || yDiff > 20.0)

But I don't know what to do there in order to disable the ball and re-enable it. You can see my attempts, commented out there.

Anyone have suggestions for how to "let go" of the ball right there, but still have the ball be enabled for input events and drag?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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