Blood Splatter on sourrounding Objects?

In many games, when you hit an enemy, blood appears on near objects. But how can a achieve this effect in the BGE? I thought about the Ray Sensor and adding a plane with a Blood-Splatter Texture, but on round or curved object (trees etc) this doesn’t work. Maybe there is a way adding the Blood Texture with UV Coords on the object? But how do I get the UV Coord? Does someone know how I can solve this? :smiley:

What you’re wanting would require a large amount of python code to accurately map a blood spatter tot he UV coordinate of an object.

There’s an easier method for flat objects. This method would create a second object, a decal, at the location that the blood splatter occurs. This method also requires python, but doesn’t require any texture mapping methods.

Are you familiar with python at all?

You could create decals as Leanardoe said and use a sensor. For example, you create the decals and put on the areas you want and make it be invisible until the monster/or player/enemy (I don’t know your case) gets hitted, when it happens the sensor would see wether area of the enemy was wounded and then would make the blood splatter decals visible.

This is something I can think it could work. I think is like what Leanardoe was indicating, if I am not wrong e.e

You can use a raycast to get the uv coordinates at a specific world position. I don’t have any good demos of this, but if you do a raycast and set the poly flag to 2, then one of the return values is the UV coordinates that the object hit.

As for how you draw on the texture, see this:

You lay also like to have a read of how they did Portal 2’s gel blobs (which left permanent marks on the walls they touched):
http://www.valvesoftware.com/publications/2011/gdc_2011_grimes_nonstandard_textures.pdf
(Page 68 or so). They had a separate texture that they painted on (and used a lightmap-like-mapping).

using bvhtree and mathutils you can get the uv of the hitpoint fast from multiple objects that are static.

check mathutils barycentric transform

https://docs.blender.org/api/blender_python_api_current/mathutils.geometry.html#mathutils.geometry.barycentric_transform