Page 1 of 1

[SOLVED] LÖVE 0.8.0 Contact:getSeparation() ?

Posted: Tue Mar 12, 2013 3:12 am
by yared0319
Has Contact:getSeparation() been removed from LÖVE 0.8.0?

It's still in the documentation at https://www.love2d.org/wiki/Contact:getSeparation, but whenever I call it on a Contact returned inside the love.physics callbacks I get the error "attempt to call method 'getSeparation' (a nil value)". Contact:getFriction() works fine and can be found in the LÖVE src. References to Contact:getSeparation was not found in the LÖVE src.

If this was pulled from LÖVE 0.8.0, what's the recommended approach to getting distance between colliders now? love.physics.getDistance(...)?

I've been lurking for about a year now, finding answers to every problem I encounter already answered in the forums or docs. Great/Fun game engine, great community! I hate for this to be the first question I ask on the forums, but ... there it is.

Here's a sneak peak at what I'm working on, in case an offering is required for first-timers ...
Image

Re: LÖVE 0.8.0 Contact:getSeparation() ?

Posted: Tue Mar 12, 2013 4:47 am
by substitute541
Um, how about plain-old pythagorean theorem? dist = sqrt(distX^2 + distY^2)?

Re: LÖVE 0.8.0 Contact:getSeparation() ?

Posted: Tue Mar 12, 2013 8:04 am
by adnzzzzZ
Maybe use Contact:getPositions and then do what substitute541 said, where distX = x1 - x2, distY = y1 - y2.

Re: LÖVE 0.8.0 Contact:getSeparation() ?

Posted: Tue Mar 12, 2013 1:55 pm
by yared0319
Ok, that's fine, I can do that. Was just going to offer to update the wiki, but someone beat me to it! Thanks!