Hello,
I am quite new with love2D, and am creating a small game using the physic module.
Is it possible to know if two shapes are colliding but not apllying any collision effects to these shapes.
For example, I have 2 ball (A & B ) moving. When they collide. I want to be able to destroy ball A, but having no effect on ball B trajectory.
If possible I would like to avoid using a different collision system like hardoncollider.
Thank you in advance.
Collision detection with no response
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Collision detection with no response
You're looking for sensors.
Re: Collision detection with no response
I think this is exactly what I was looking for. Thank you very much!
Re: Collision detection with no response
I tried, and it worked
But I had a small problem : it seems that setting this attribute take only effect at the next frame. So if when I create the ball, it is immediatly colliding with the other ball, there is a physical response.
To fix it I set a mask for one frame, but It is not really good, because I finnaly have to wait 2 frame before beeing able to handle the collision (1 for unsetting the mask and 1 for getting the collision callback)
Did I missed something or maybe a bug with Löve ?
But I had a small problem : it seems that setting this attribute take only effect at the next frame. So if when I create the ball, it is immediatly colliding with the other ball, there is a physical response.
To fix it I set a mask for one frame, but It is not really good, because I finnaly have to wait 2 frame before beeing able to handle the collision (1 for unsetting the mask and 1 for getting the collision callback)
Did I missed something or maybe a bug with Löve ?
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Collision detection with no response
Destroying physics objects is kind of an odd thing in Love: as far as the community has been informed, you shouldn't do it, ever, because it leads to crashes. https://bitbucket.org/rude/love/issue/1 ... -not-crash http://love2d.org/forums/viewtopic.php?f=4&t=2565 Try masking it out instead, that's the semi-official response.
Kurosuke needs beta testers
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Collision detection with no response
@tentus: He's not trying to destroy it..
Anyway, what about running world:update(0)?
Anyway, what about running world:update(0)?
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: Collision detection with no response
I think he is:bartbes wrote:@tentus: He's not trying to destroy it..
thib wrote:For example, I have 2 ball (A & B ) moving. When they collide. I want to be able to destroy ball A, but having no effect on ball B trajectory.
When I write def I mean function.
Re: Collision detection with no response
Yes I am, but this is not the problem of this thread ;-) I already saw the other thread, but thank you anywaykikito wrote:I think he is:bartbes wrote:@tentus: He's not trying to destroy it..
thib wrote:For example, I have 2 ball (A & B ) moving. When they collide. I want to be able to destroy ball A, but having no effect on ball B trajectory.
My problem occurs event if I dont destroy the ball.
It helps, but I still need to set the mask to make it works as I wantbartbes wrote:Anyway, what about running world:update(0)?
Code: Select all
self.shape:setSensor( true )
self.shape:setMask(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 15, 16)
world:update(0)
self.shape:setMask()
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 10 guests