Collision and destroy problems

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.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Collision and destroy problems

Post by rude »

I don't really use any IM clients, but if you have GMail, we can use the built-in chat system ... (andruud at gmail dot com)

I might go to sleep now, though. 5am local time, ffs. >_<
User avatar
Nexion
Prole
Posts: 46
Joined: Fri Sep 05, 2008 1:40 pm

Re: Collision and destroy problems

Post by Nexion »

Posting the erroring files for rude
Attachments
Missle Command.rar
(210.28 KiB) Downloaded 111 times
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Collision and destroy problems

Post by rude »

(This has now been fixed. Nexion overlooked a small but significant detail, the exact nature of which need not be revealed. :D)
User avatar
Nexion
Prole
Posts: 46
Joined: Fri Sep 05, 2008 1:40 pm

Re: Collision and destroy problems

Post by Nexion »

Hey! Just because I didn't realize that I installed 0.5.0 to the computer I was working on and not my flash drive does not mean that I was wrong.

Oh wait... yes it does...

And yes, rude, you DO have Scarlet Johanson on your bed
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Collision and destroy problems

Post by rude »

I do? Awesome.
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

Re: Collision and destroy problems

Post by Kaze »

rude wrote:Ah, I just noticed that myself! :D

Silly me, I should have paid more attention to your code. On the plus side, all this love.physics-investigating has been been very useful. I found at least one weakness I didn't consider.

This code will create a cyclic dependency, and the shape/body can never be garbage collected.

Code: Select all

local b = love.physics.newBody()
local s = love.physics.newShape(b)
local t = { b = b, s = s }
s:setData(t)
I suppose weak tables or something would be a solution to this.
You could call t.s:setData("") to remove, in that case (in the collision callback).
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Collision and destroy problems

Post by rude »

You're absolutely right.

Code: Select all

-- But you meant to set it to nil, I assume.
t.s:setData(nil)
User avatar
Kaze
Party member
Posts: 189
Joined: Sat Jul 19, 2008 4:39 pm
Location: Dublin, Ireland

Re: Collision and destroy problems

Post by Kaze »

rude wrote:You're absolutely right.

Code: Select all

-- But you meant to set it to nil, I assume.
t.s:setData(nil)
Wasn't sure if it accepted nil, but yeah.
User avatar
Lord Tim
Prole
Posts: 30
Joined: Sun Jul 20, 2008 4:07 am

Re: Collision and destroy problems

Post by Lord Tim »

I'm not sure if this was related to destroy() not working, but getCollideConnected() and setCollideConnected(collide) for joints do not seem to be working at all. Saying it's a nil value.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Collision and destroy problems

Post by rude »

First of all: destroy() works. Ok? Ok. :D

I haven't tested those functions (lately), but I checked the SWIG interface just now, and the functions are listed (which means that they shouldn't cause a nil-value error, although they may still not work as expected, of course). I'll try to do an actual test later today.
Post Reply

Who is online

Users browsing this forum: Amazon [Bot] and 12 guests