How can I get the surface id assigned to a face on a mesh?
Asked Answered
C

4

0

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!

Cotemporary answered 22/3 at 0:58 Comment(0)
D
0

Cotemporary What do you need this for?
Btw faces are "assigned" to surfaces, not the other way around.

Dasya answered 22/3 at 13:31 Comment(0)
C
0

Dasya Oh my bad.

Basically, I'm trying to have impact effects/sounds that change based on the surface material of whatever my bullet hits.

So if its sand, dusty sound, wood, splintering sound, etc.

Cotemporary answered 22/3 at 15:3 Comment(0)
H
0

Cotemporary 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
Hepner answered 22/3 at 15:16 Comment(0)
C
0

Hepner 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.

Cotemporary answered 22/3 at 19:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.