Jump to content

Recommended Posts

Posted

Hallo, 

If I have a skeletal model with one mesh but two materials, how can I access the second material?

The second material is used for the eyes.
At game start the eyes should be dead (no emission) and only start glowing after activation.

If the eyes were a child entity, this would be easy.
But what is the correct way when there is only one mesh?

Posted

Thanks Josh, that explanation helps to understand the internal structure.  

What I’ve confirmed so far:

If a model (or mesh) uses only one material, GetMaterial() and SetMaterial() work as expected and the material can be fully replaced.

However, if the same mesh uses multiple materials (multiple material slots), Lua does not provide a way to replace a single material slot.

In that case, SetMaterial() affects the entire model and individual materials cannot be swapped — only modified (e.g. emission, color).

 

So replacing the eye material entirely is only possible when the eyes are exported as a separate child model, or when the model uses a single material.

Please let me know if I’m missing something on the Lua side — happy to learn

My model

LOD1 —> mesh1 body :material            
            |—> mesh1 eye: material

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...