Rastar Posted February 9, 2014 Share Posted February 9, 2014 I am trying to get the first surface of a model patch:GetSurface(0) but only get attempt to call method 'GetSurface' (a nil value) Is that not exposed to Lua? Quote Link to comment Share on other sites More sharing options...
shadmar Posted February 9, 2014 Share Posted February 9, 2014 Default exmaple seems to work : http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/model/modelgetsurface-r344 (if you exchange barabarian with the crawler).. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Rastar Posted February 9, 2014 Author Share Posted February 9, 2014 Ah, it seems GetSurface() is not available for an instanced model. So local model = Model:Create() model:AddSurface() local surface = model:GetSurface(0) run fine, but the following local model2 = model:Instance() local surf2 = model2:GetSurface(0) gives the described error. Quote Link to comment Share on other sites More sharing options...
shadmar Posted May 1, 2014 Share Posted May 1, 2014 Abit late now perhaps, but this would work to use methods on the instanced one. local model2 = model:Instance() model2 = tolua.cast(model2,"Model") local surf2 = model2:GetSurface(0) Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Josh Posted May 2, 2014 Share Posted May 2, 2014 Model:Instance() returns an Entity object, which needs to be cast to a model. 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...
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.