Issue with ChainShape

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
User avatar
DavidOliveiraSilva
Prole
Posts: 19
Joined: Fri May 29, 2015 10:19 pm
Location: Quixadá, Brazil
Contact:

Issue with ChainShape

Post by DavidOliveiraSilva »

[0.10.2]
Yes, I saw the warning on wiki that collisions with ChainShape can react in a odd manner. But my problem is different, it's due to my own lack of knowledge >.<
that's why I came to ask for help :3
I'm making a spaceship game. Using the right-click you enable a circle-shaped Shield around you. I choose to use the ChainShape instead of CircleShape, because I don't want my spaceship colliding with the shield.
All the bullets need to collide with the shield, even my own bullet (I don't want the player using shield and shoting at the same time). When a bullet collide with the shield, the bullet is destroyed. Nice. It works beautifully! I could defend myself from a storm of bullets that destroyed me in the same frame that I released the shield. So, the chainshape works fine.
The problem is when I destroy the ChainShape. My bullets get destroyed as if the shield is still there, but part of enemies bullets doesn't get destroyed and reachs me.
Image
(play with mouse and WSAD)
Attachments
game.love
(5.11 MiB) Downloaded 143 times
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Issue with ChainShape

Post by ivan »

Chain shapes are basically a series of edges - very fast moving objects may tunnel through the chain shape,
which can be partially alleviated using the 'SetBullet' option.
In your case I'm not sure why you're not just using a circle shape.
Generally speaking you don't want to be creating/destroying objects all the time,
my suggestion is to keep the shield as a circle shape at all times,
simply change its filtering/masking settings whenever you want to deactivate it.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], immortalx and 2 guests