Skip to content
Discussion options

You must be logged in to vote

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.

Okay, here we go:

ray.get_collider().get_parent().materials[0].albedo_texture.resource_path.get_file().trim_suffix(".png")

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.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@blackears
Comment options

@elvisish
Comment options

Comment options

You must be logged in to vote
1 reply
@elvisish
Comment options

Answer selected by elvisish
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants