Disabling joints with physics API

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
SelectricSimian
Prole
Posts: 3
Joined: Sat Dec 22, 2012 11:40 pm

Disabling joints with physics API

Post by SelectricSimian »

I'm working on a game using the love.physics module, and my player needs to grab onto walls. Currently, I'm doing this by creating a rope joint between the player's hand and the wall. This works fine, but I can't figure out any way for the player to let go! joint:destroy() destroys the joint and the objects it's attached to, which is absolutely not what should happen. What I need is some way to disable, remove, or otherwise nullify the rope joint without destroying the player. Any help is appreciated! Thanks in advance!
SelectricSimian
Prole
Posts: 3
Joined: Sat Dec 22, 2012 11:40 pm

Re: Disabling joints with physics API

Post by SelectricSimian »

Answering my own question in case anyone comes across this later. The answer is actually shockingly simple: just use joint:destroy()! I had tried this, but due to a bug in my code it didn't work, and I assumed it had a different purpose than to actually literally destroy the joints, such as memory management. After fixing my bug, the function works perfectly.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 4 guests