Jump to content

Recommended Posts

Posted

Hi ! I just want to know if it is possible to have acces the Model method in a lua script that has been attached to a model in the scene editor.

 

I wanna do something like

 

my_model = tolua.cast(self.entity , "Model")

my_surface = my_model:GetSurface(0)

 

I want a script that I can attach to any model in a map scene...

 

 

Thanks.

Posted

Thanks for your reply Genebris

 

But I did test it, and it doesn't seem to work straight from the script attached. I guess I could load the model from the main.lua so I could declare it global and access it on a private script... but that wasn't my goal.

 

I was just curious to know if it could done, that is, to attach a script to a model entity and to use it to animate the vertex of an object for exemple ... I read the forum, and it seem that lua script only access the entity...It's ok... I was just asking, as a beginner , to be sure I wasn't missing something simple here...

 

Thanks again for your answer....

Posted

Doesn't work , when i attach this script to a box:

 

function Script:Start()

mySurface = self.entity:GetSurface(0)

System:Print(mySurface:CountVertices())

end

 

I get this error at line 2:

2 : attempt to call method 'GetSurface' (a nil value)

 

and the script stop with a requester.

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