Jump to content

  • Log In with Google      Sign In   
  • Create Account


UDK - Changing Material When Player Walks


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Dom M   Members   -  Reputation: 116

Like
0Likes
Like

Posted 09 March 2013 - 08:42 AM

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



Sponsor:

#2 ratrace135   Members   -  Reputation: 439

Like
1Likes
Like

Posted 10 March 2013 - 02:41 PM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS