• News

• Industries

• Learning & Support

• Community

• Marketplace

# Align footprint decal to ground normal and foot direction

I’m struggling with the maths for this…

So, I want my 3P character to leave footprints behind her when she walks/runs. I have everything working fine when she walks on totally flat surfaces - the footprint decals spawn right under her feet and align themselves to her foot direction. What I cannot figure out is how to do this when the surface is anything other than flat.

I’m using a socket on the foot (each foot, actually) to line trace to the surface. This gets me the socket rotation when the impact occurs and the ground normal at the point of impact (which is a vector).

(1) If I spawn a decal with just the foot rotation’s rotation, the prints align to the foot direction on flat surfaces.

(2) If I spawn a decal with just the normal (converted to a rotation) as the decal’s rotation, the decals sit nicely on the irregular surface.

So how do I combine (1) and (2)?

I need to somehow combine a rotation (of the foot) with the normal (of the ground) so that the decals spawn in a way rotated to match the normal AND the rotation of the foot.