Disabling joints with physics API
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 3
- Joined: Sat Dec 22, 2012 11:40 pm
Disabling joints with physics API
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!
-
- Prole
- Posts: 3
- Joined: Sat Dec 22, 2012 11:40 pm
Re: Disabling joints with physics API
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.
Who is online
Users browsing this forum: Google [Bot] and 4 guests