Jump to content

Colliding objects stuck in collision state?


trog
 Share

Recommended Posts

Hi all,

I discovered melonJS yesterday and have been tinkering around with it over the weekend; I found it generally very easy to get up and running and very fun to play with.

However, I have what I think is probably a very beginner problem with collisions. I have a simple 2d map on which a bunch of sprites are moving around randomly. Usually when they collide, they correctly bounce off each other and go on their separate ways.

Sometimes though they will seem to stick together, and then go flying off together in a totally random direction, at a velocity that exceeds the maximum set velocity.

I have been trying to debug this for hours but can't figure out what is going on - it looks like the objects collide (I think mostly from a corner, instead of the sides) and then overlap too much, forcing them to get stuck in a way that makes the overlaps confused - so they can't figure out which way to go.

I have tried limiting their velocity in the main update loop but this doesn't seem to affect them.

It's based just off the boilerplate project in Github, so it's using an older version of the melonJS library - I tried updating to the latest v7 and it still does the same thing.

I have the project online at https://trog.qgl.org/up/2003/boiler/ ; the relevant entities file is at: https://trog.qgl.org/up/2003/boiler/js/entities/entities.js .

Any help appreciated; I have been tearing my hair out for hours on this.

Thanks,

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