Death determined by physical materials in UE4

I’m having trouble implementing a death sequence-like thing determined by which material the player is touching. I’m pretty much a beginner when it comes to unreal engine 4 so its probably a simple problem even if it doesn’t seem simple to me but even though I have made a system that detects which physical material the player character is touching and plugs into a select that pretty much says that if it is the “UDie” physical material spawn death particle and if it is the default physical material dont do anything, ill put an image below. ( also slightly random but if your wondering I’m recreating slope game :sunglasses: )

and I also have a video proving that it is detecting the physical material right here as well

well nevermind, it say new users cannot upload attachments ( which is mildly annoying ) so you’ll have trust me on this one. also every so often it’ll give me this error message but its quite random when it happens and when it doesn’t so I’m not sure if its that helpful but ill show it anyway

thank you in advance for the help and even though it is slightly outdated I am using unreal 4.26 so I hope that doesn’t change the answer to much

so… which part isn’t working?

the error is occurring when your HitComponent is None, you’re still trying to access GetMaterial on it.

You need to enable “Return Material on Move” in the collision → Advanced section.

Every Actor Component that you want to get material info from has to have this enabled.

image

Also you should be able to just use the Phys Material pin from the hit result.

Hit result → Phys Mat → Surface type

1 Like

I’m dumb, really dumb. After looking at it for another 3 hours trying to deduce the problem I pressed f8 and I had told the particles to spawn at something that wasn’t correctly parented to the character so it spawned where I couldn’t see it. SOOOO sorry for the inconvenience!!!

1 Like