Jump to content

Recommended Posts

Posted

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?

Posted

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.

  • 2 months later...
Posted

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)

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Posted

Model:Instance() returns an Entity object, which needs to be cast to a model. :)

My job is to make tools you love, with the features you want, and performance you can't live without.

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