Jump to content

how do I move a 3D object without using self.entity


DarkCastiel
 Share

Recommended Posts

Hi, I'm having trouble understanding the syntax. how do I reference an actor or 3D model on the map using the (lua)?
in c# i would do something like that

crawler.transform.translate (-0.05f,0,0,Space.self);

but I just don't understand how to apply this to Leadwerks (LUA)

I don't want to use
"self.entity" because the script is not attached to the "crawler"

can someone explain this syntax to me better? thanks

suppose i have to create a variable and attach the crawler.entity or something?

 

function Script:Start()

entity = crawler

crawler.entity:SetPosition(0,180,0)

end

Link to comment
Share on other sites

I already found the solution, I needed to create a lua script on my npc and referred the selft.entity to a variable to be its name

 

function Script:Start()

BigAlien = self.entity

end

 

so now i can use for example

BigAlien:SetColor(0.0,0.0,1.0)
BigAlien:SetRotation(0,-180.0)

with a lua script on any npc or object

I thought that after putting the model on the map and I just needed to put its name (crawler) but no I need to reference the self.entity inside it to name it in the end now everything makes sense......?

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...