Hgawmphdmph Posted July 26, 2020 Share Posted July 26, 2020 Hi, I'm trying to programmatically get model info in lua. I have imported a simple cube model with the same texture on all 6 faces. In the model editor it is shown as having a single surface, index 0 with the expected material. However, when I try to access this from code I can't find the surfaces. In a script attached to the entity I've tried: local surfaces = self.entity:CountSurfaces() and local model = tolua.cast(self.entity, "Model") local surfaces = model:CountSurfaces() All of which show indicate there are zero surfaces. I've scoured the documentation but can't work out what I'm doing wrong. And ideas? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Solution Josh Posted July 26, 2020 Solution Share Posted July 26, 2020 Maybe the model has children that contain the surfaces? 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Hgawmphdmph Posted July 26, 2020 Author Share Posted July 26, 2020 Absolutely spot on, thank you. I hadn't occurred to me that the model would get parented to an empty one when loaded. I can now find the triangles list and everything. Is there some way I need to mark this as the right answer like in some other forums? Thanks again! Really appreciate the help. Quote Link to comment Share on other sites More sharing options...
Hgawmphdmph Posted July 26, 2020 Author Share Posted July 26, 2020 I should also mention that looking again in the model editor and even in the scene graph pane in the LW editor, I can now see that I have a "cube" object parented to a STATIC_MESH object, so the fact that the loaded mesh was parented is completely self evident. I just wasn't looking at it properly! Duh! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.