Mario

How to detect collisions while dragging a sprite?

Recommended Posts

Hi,

 

is it possible to check if a sprite collides with others while dragging it?

 

I am trying to build a game where you can rearange items, but physics/collision detection seems to be deactivated for the dragged sprite. Therefore items will overlap. I need a solution to prevent overlapping. Anything included in Phaser?

 

So far I tried this:

game.physics.collide(group, group);

It works as expected for falling items, but not while dragging.

 

Thank you

Mario

Share this post


Link to post
Share on other sites

I would use game.physics.overlap() instead and then you'll need to handle what happens if they do overlap yourself really. Collide is meant to work across body motion, of which a sprite doesn't currently have any while being dragged. When we integrate p2.js later on you'll finally be able to do this though, but not yet.

Share this post


Link to post
Share on other sites

I would use game.physics.overlap() instead and then you'll need to handle what happens if they do overlap yourself really. Collide is meant to work across body motion, of which a sprite doesn't currently have any while being dragged. When we integrate p2.js later on you'll finally be able to do this though, but not yet.

 

when will you integrate p2.js ? 

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...

  • Recently Browsing   0 members

    No registered users viewing this page.