UDK - Changing Material When Player Walks

Started by
0 comments, last by ratrace135 11 years, 1 month ago

I've been using UDK for a few weeks and came across a small problem earlier that I can't seem to figure out. I'm wanting to change the material on a terrain as the player walks over it and can't find a way of doing this (I've been looking through and trying various kismet options). I have searched Google for an answer but haven't had any luck and although it's not a feature that I can't live without, I would really like to implement it, so if anyone knows how I can achieve this I would really appreciate the input.

tl;dr:

I'm wanting to make it so that when the player walks over a muddy terrain the patches walked on turn to grass.

Thanks,

Dom

Advertisement

Yeah, that's definitely not something that kismet will be able to do... I looked through the Unrealscript terrain code and I don't see any easy way you'd be able to modify layer blending from there either. However, I'm not sure that modifing the layer blending would be the best way to acheive that effect in the first place. To get the patches to appear with a relative accuracy to where the player's feet are landing, the terrain would have to be tesselated way too densely. A better option might be to spawn a decal or particle system (or both) where the player's feet land, which wouldn't be too hard to implement, though you'd have to muck around in Unrealscript code.

I'm not sure if you're interested in doing that, but if you are, then basically all you'd have to do would be to extend the UTPawn class, modify the GetMaterialBelowFeet() function to store the material under the player's feet, and modify the ActuallyPlayFootstepSound(int FootDown) function to compare that material with whatever your mud material is and to spawn the corresponding decal/particle system if it's the right material (and then you'd have to extend the UTGame class to reference your pawn class instead of UTPawn). Not the most elegant solution, but it wouldn't require any additional functions and would keep the additional code required to a minimum.

This topic is closed to new replies.

Advertisement