-
-
Notifications
You must be signed in to change notification settings - Fork 642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAT based algorithm for collision detection/response #394
Comments
I don't know why I forgot to add a reference to this ticket at each commit, but it's there now in the master branch ! a few comments :
Some to-do list (in no particular order) :
|
On the quadtree topic (although kind of a different topic) : |
@agmcleod @parasyte hi guys, some advice required here : What do you think we should do with the following : Also, i was thinking to turn the current |
I'm pretty comfortable where it is. I like the idea of keeping it dry with re-using pooling, but the method here is also pretty clean, given it's just vectors. It's how i did pooling for the 4 vector points in a bezier curve in snowball. I prefer me.Solver simply because. me.collision.collide reads kinda funny :) |
It's probably fine, the way it is. The melonJS pool code adds an extra property to the object to determine its type. Probably not the best thing, but that's how it is currently. The old #103 API uses a |
Good, i'm keeping the light pooling functions then :) Else for me.collision my idea was then to rather define a new |
just noticed a weird bug this morning in melonJS and i cannot find the root cause :) when using Ellipse shape in Tiled, the final display (in the browser) size is wrong, as somehow (but I cannot find where) the object width and size got modified. This is however working perfectly when creating shape object manually (see the shape example) |
that is rather interesting. I'll see if i can have a look this evening. On master? |
Yea... I'm taking a 7h flight later, will keep trying as well (although i barely have 3h of battery with my laptop) |
dang. I think mine has around 4 or 5 hours total these days. Safe flight! On Mon, Jul 14, 2014 at 9:09 AM, Olivier Biot notifications@github.com
Aaron McLeod |
Shitty company windows laptop, and i did not take my MBA, my fault :(
|
@obiot so i put up a small example. 822b2b4 I was able to place a circle object, and then draw it to the correct position. I just had to account for the x y + radius, since tiled coordinates are top left for circles, but in the canvas it's the center. I also changed the constructor slightly for the ellipses as it was initializing a new vector to this.pos, then passing the vector to the setShape() method, so i removed that redundency. |
also made the previous API now deprecated
Hi Guys, with this last very commit :
I would appreciate if you could go through the documented API and provide feedback (positive or negative), and so that we can "freeze" the API. I also added the possibility to deactivate the SAT collision detection and just basically use AABB detection with a simple true being returned in case of collision (might be useful for very simple case where no advance collision detection is required ?) |
@obiot I'll try to find some time to look at this. My week is super busy (work) and I'm trying to balance that with my other personal projects. ;) This is something I'm very interested in, however. So I may have a lot of [constructive!] criticism by the time I get around to it. |
ahah, no problem, we are not in a hurry anyway, and I can keep working on it (like tracking that f**** issue with the ellipses) or work on other things (my next step is to add the quadtree code I was referring too earlier) in the mean time. |
Note : any update to the English itself is also much appreciated, just to ensure that just more than just french speaking english understand it correctly :) |
good news : there was no bug with the me.Ellipse object in melonJS, this is due to a bug in the platformer example, that forces the width and height properties in settings to different values before calling the parent constructor ! took me a loooong time to figure it out, just for a stupid bug not in melonJS at the end ! anyway I'm happy :P |
also made the slimEntity "solid" in the platformer using the given response object
added an example for the new `me.collision.check`, and remove the ones for the deprecated functions.
closing this one ! |
we discussed this already in the forum (and also as part of #103), but i'm creating a ticket for it, so that this is clearly identified.
Now that we correctly (at 99%) support polygone/polyline shape in melonJS this should be quite straightforward to implement, and implementation in javascript like the following are already a great reference :
https://github.com/jriecken/sat-js
Basic AABB detection (through the
shape.getBounds()
function) could still be used during broad phase, and then SAT to precisely calculate responses for colliding objectsAdditional bonuses for this one :
me.Rect
class as a subclass of polyshape #366 so that we only care about polygon to polygonThe text was updated successfully, but these errors were encountered: