Bullets that Penetrate -- damage objects but don't collide
Posted: Tue Sep 09, 2014 5:15 pm
[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!
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!