Got two surfaces on my map mesh assigned to some faces on the geometry. I am able to get the specific face IDs on the mesh, so what can I do to get the surface assigned to that face? Any help is appreciated!
How can I get the surface id assigned to a face on a mesh?
wontairr use different physics objects.
Your meshinstance is visual only, your collisions happen on a physics object that has a collider. You need 2 different surfaces, use two different physics objects with 2 different colliders.
And while you're at it, put all the colliders sharing the same properties on the same physics objects, that way you have fewer physics objects with the same number of colliders.
Ex:
Wall staticbody
|
Wall 1 collider
Wall 2 collider
Floor staticbody
|
Floor sand
Floor staticbody 2
|
Floor concrete
- Edited
Jesusemora Sorry, I should've mentioned I'm using trenchbroom with qodot. It makes the map a single staticbody with separate colliders for each part of the map (brushes).
I am able to get the specific face ID I shoot at on the mesh through some functions, so If I can get the surface that face is assigned to I can do the proper effects based on that.
- Best Answerset by wontairr
For anyone using Qodot and Trenchbroom needing to get the texture name of a face on a brush with a raycast, I created this short tutorial that'll teach you how I did it.
https://docs.google.com/document/d/1zYy516GXqWPIGeL3B8wOqFixHCC0XNq4boGBUFJ5QEE/edit?usp=sharing
- Edited
yelfog I tried wontairr's solution, but get_map_brush_info() is returning "{ "0": [] }" and I'm getting nulltexture every time I run the get_texture_name() function. Any ideas what I could be doing wrong here?
Edit: changing "var split_1 = map_file.split("\r\n")" to "var split_1 = map_file.split("\n")" and applying your fix solved it!