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

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
Snackrilege
Prole
Posts: 19
Joined: Sat Sep 06, 2014 8:50 pm

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

Post 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!
Last edited by Snackrilege on Tue Sep 09, 2014 8:29 pm, edited 2 times in total.
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

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

Post by Plu »

You're looking for Sensor Fixtures:
http://love2d.org/wiki/Fixture:setSensor
Snackrilege
Prole
Posts: 19
Joined: Sat Sep 06, 2014 8:50 pm

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

Post 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.
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

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

Post 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!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests