I just want an object to act as though it wasn't there, not colliding with anything? How would I do that?
Thanks in advance!
How do you temporarily disable collisions? - love.physics
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How do you temporarily disable collisions? - love.physics
Not quite sure what you mean. If you don't want one object to collide with another object just don't check for collisions.
If you mean you only want it to not collide when say, a button is being held down, you could set a Boolean variable like canCollide=true
Then you could set that to false when you hold the button and have collision be checked only if canCollide is true.
Without knowing exactly what you mean and/or seeing the love file, it's hard to help, at least hard for me to help but I'm pretty new lol
If you mean you only want it to not collide when say, a button is being held down, you could set a Boolean variable like canCollide=true
Then you could set that to false when you hold the button and have collision be checked only if canCollide is true.
Without knowing exactly what you mean and/or seeing the love file, it's hard to help, at least hard for me to help but I'm pretty new lol
Re: How do you temporarily disable collisions? - love.physics
I'm using the physics-module and don't know how I would go about disabling collisions (both check and callback) for one body/shape/fixture. Sorry for not making that clear enough.Vimm wrote:Not quite sure what you mean. If you don't want one object to collide with another object just don't check for collisions.
If you mean you only want it to not collide when say, a button is being held down, you could set a Boolean variable like canCollide=true
Then you could set that to false when you hold the button and have collision be checked only if canCollide is true.
Without knowing exactly what you mean and/or seeing the love file, it's hard to help, at least hard for me to help but I'm pretty new lol
Re: How do you temporarily disable collisions? - love.physics
Ah I don't think I can help then, I tend to avoid the physics module for reasons like that. I generally check collisions just by using a collision functionOvidios wrote:I'm using the physics-module and don't know how I would go about disabling collisions (both check and callback) for one body/shape/fixture. Sorry for not making that clear enough.Vimm wrote:Not quite sure what you mean. If you don't want one object to collide with another object just don't check for collisions.
If you mean you only want it to not collide when say, a button is being held down, you could set a Boolean variable like canCollide=true
Then you could set that to false when you hold the button and have collision be checked only if canCollide is true.
Without knowing exactly what you mean and/or seeing the love file, it's hard to help, at least hard for me to help but I'm pretty new lol
Re: How do you temporarily disable collisions? - love.physics
The easiest way is to use 'Fixture:setFilterData' to set the collision filtering mask to 0. Assuming you haven't changed any of the category, mask or group data, that would look like this: 'fixture:setFilterData(1, 0, 0)' and then turning collisions back on would be like this: 'fixture:setFilterData(1, 65535, 0)'.
Love also provides 'Fixture:setMask' (https://love2d.org/wiki/Fixture:setMask) which is a nicer way of dealing with those masks if you aren't used to bitwise operations. In your case where you want to turning everything off, though, 'setFilterData' is probably more straightforward.
You can read more about this stuff in the Box2D manual. http://www.box2d.org/manual.html
Love also provides 'Fixture:setMask' (https://love2d.org/wiki/Fixture:setMask) which is a nicer way of dealing with those masks if you aren't used to bitwise operations. In your case where you want to turning everything off, though, 'setFilterData' is probably more straightforward.
You can read more about this stuff in the Box2D manual. http://www.box2d.org/manual.html
Re: How do you temporarily disable collisions? - love.physics
Thanks! Got it to work using "Fixture:setMask" since I only had one moving object!Tanner wrote:The easiest way is to use 'Fixture:setFilterData' to set the collision filtering mask to 0. Assuming you haven't changed any of the category, mask or group data, that would look like this: 'fixture:setFilterData(1, 0, 0)' and then turning collisions back on would be like this: 'fixture:setFilterData(1, 65535, 0)'.
Love also provides 'Fixture:setMask' (https://love2d.org/wiki/Fixture:setMask) which is a nicer way of dealing with those masks if you aren't used to bitwise operations. In your case where you want to turning everything off, though, 'setFilterData' is probably more straightforward.
You can read more about this stuff in the Box2D manual. http://www.box2d.org/manual.html
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot] and 4 guests