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

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
yared0319
Prole
Posts: 4
Joined: Thu Jan 19, 2012 2:44 am

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

Post 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
Last edited by yared0319 on Tue Mar 12, 2013 4:36 pm, edited 2 times in total.
User avatar
substitute541
Party member
Posts: 484
Joined: Fri Aug 24, 2012 9:04 am
Location: Southern Leyte, Visayas, Philippines
Contact:

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

Post by substitute541 »

Um, how about plain-old pythagorean theorem? dist = sqrt(distX^2 + distY^2)?
Currently designing themes for WordPress.

Sometimes lurks around the forum.
User avatar
adnzzzzZ
Party member
Posts: 305
Joined: Sun Dec 26, 2010 11:04 pm
Location: Porto Alegre, Brazil

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

Post by adnzzzzZ »

Maybe use Contact:getPositions and then do what substitute541 said, where distX = x1 - x2, distY = y1 - y2.
User avatar
yared0319
Prole
Posts: 4
Joined: Thu Jan 19, 2012 2:44 am

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

Post 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!
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests