Jump to content

How to resolve collision without either physics bodys being pushed?


MrBill
 Share

Recommended Posts

I'm making a game with Arcade physics where I want it so two moving objects are not able to push each other on collision. The default Phaser behavior is that the body with the most force / velocity will push the other. Here's a crude diagram showing what I mean:

image.thumb.png.7baebc36f01af8eb985c93ebfe0d99e4.png

I've tried setting both bodies to be not pushable (through body.pushable = false), one body to be not pushable and the other to be immovable, both immovable, etc. and none of the combinations seem to work how I want it.

Is what I want possible with default behaviours? It seems odd that it wouldn't be since I can see many use cases for this.

A similar question has been asked before in the thread below but it looks like no one there was able to figure it out.

Edited by MrBill
Link to comment
Share on other sites

Found a solution I think.

I got what I desired by setting both bodies to not be pushable (body.pushable = false) and then making sure to set their velocities to 0 when they're touching.

Also I just realized how dead this side of the forum is. I guess I'd be better off just using the Discord or other forum.

Link to comment
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...
 Share

  • Recently Browsing   0 members

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