Page 1 of 1

Disabling joints with physics API

Posted: Thu Dec 26, 2013 6:53 am
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!

Re: Disabling joints with physics API

Posted: Sat Dec 28, 2013 5:00 am
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.