-
Is it possible to get materials from blocks? I want to use different footsteps for different materials and but am not sure how to get them with a ray node (it just returns StaticBody3D or its children, CollisionShape3D). |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Okay this seems to sort of work, though it's a little clunky: get_collider().get_parent().materials[0] But this is just giving me a UID I think, instead of a reference to the material, or even the material name (most useful): |
Beta Was this translation helpful? Give feedback.
-
I'm not exactly sure what you're doing, but I think get_collider() returns the StaticBode3D with the collision. The get_parent() takes you to the CyclopsConvexBlockBody which should have a child that is a MeshInstance3D which has the actual mesh. You should be looking there for the material. Then again, this is likely to change fairly shortly after the redesign. |
Beta Was this translation helpful? Give feedback.
Okay, here we go:
I've no idea how performant this is, but it works. It would be nice if there was a slightly tidier way of doing this, but it's good enough for occasional footstep sounds.