Page 1 of 1

Bullets that Penetrate -- damage objects but don't collide

Posted: Tue Sep 09, 2014 5:15 pm
by Snackrilege
[SOLVED]

to make fixtures that do generate collisions (and thus affect anything with which they collide), but can still share space, use a sensor fixture.

http://love2d.org/wiki/Fixture:setSensor

------------------------------------------------------------
------------------------------------------------------------



Ignoring collisions in love.physics is easy, but I'd like to figure out how to make objects that "quasi-collide" with desired categories.


For instance, imagine a bullet fired from a high powered sniper rifle. It might pass through several walls before finally becoming lodged in a particularly dense concrete wall, or shattering when it hits the surface of water or the ground.


Imagine likewise a pool of water. You can share space with it (be "inside" of it), but it still affects you. It slows down your movement and applies a constant upward force proportional to your bouyancy.

Consider a pool of acid. It acts like water, but constantly damages anything unfortunate enough to come in contact with it.


These things all share a common thread. Just like regular fixtures with filters and masks, they do affect anything (except for ignored categories) that touch, or are touched by, them -- they generate collisions accordingly. Unlike regular fixtures, however, they can share a space with anything they collide with.

Is there an established way to make this work? I'm going to run some tests to try and solve this on my own. Firstly, I want to see what happens if you create a fixture and body without attaching a shape.

Thanks for your help, LÖVErs!

Re: Bullets that Penetrate -- damage objects but don't colli

Posted: Tue Sep 09, 2014 5:28 pm
by Plu
You're looking for Sensor Fixtures:
http://love2d.org/wiki/Fixture:setSensor

Re: Bullets that Penetrate -- damage objects but don't colli

Posted: Tue Sep 09, 2014 5:45 pm
by Snackrilege
Ah, yeah, that's it precisely. Thanks, Plu. Gosh, I'm batting a thousand with these long questions that can be answered with one or two words.


Thanks again. Extremely helpful.

Re: Bullets that Penetrate -- damage objects but don't colli

Posted: Tue Sep 09, 2014 5:49 pm
by Plu
No worries, that's always how it begins :)

Soon you'll be knee-deep in a project and you'll have to do everything yourself, so enjoy the available solutions while they last!