Game
Floatlands
9 years ago

Projectile penetration


Lots of games don’t have this feature of Projectile penetration, it’s a very good gameplay element and this is why it was added. It becomes very fun to play, because you can damage an opponent through a wall. Lets look at some examples, so you can get a taste of what this feature can do.

Penetration calculation includes a huge amount of math. Angle between a normal and projectile direction tells you how orthogonal to surface the bullet is. There is more chance that a bullet will penetrate, if it is orthogonal to the surface. Also, each projectile loses »mass« so that its weaker after penetration. It can also happen that a bullet doesn’t penetrate but bounces off instead.


SHOOTING QUAD WALLS:

There is also another raycast from another side of collider, (reverse direction of bullet) so that code can determine how deep penetration will be. The deeper, the less chance that it will penetrate (or not at all).


SHOOTING TRIANGLE WALLS:

From this little experiment it’s visible that triangle walls are much more protective against bullets than just straight quad walls.


A little bit of programmers speak:

Every MonoBehavior that will be penetratable needs to implement this IPenetratable interface. Then you can just call GetComponent<IPenetratable>() on collider and if it’s not null, you can go on and calculate penetration from porosity and max depth.

		
			public interface IPenetratable
{
// [0, 1] - measures emptiness of volume
float GetPorosity();

// (0, +inf)
// max depth
float GetMaxPenetrationDepth();
}
		
	

http://floatlands.net



0 comments

Loading...

Next up

DeepEnd Submarine

Player panel showing all the player stats, gear and your PAL (companion) stats as well.

Buzzard helicopter

Working on game weather, cloudiness in this particular case.

Playing around with player skins.

Biome color experimenting

Procedurally generated example of Mainland and nearby ground islands with lots of biomes.

Added some basic icons to player panel.

Show companion animation

Polishing our new grass solution.