Jump to content

How to Make a vent rotate? ... Lua Script


R.E.Z.
 Share

Recommended Posts

Hello,

 

I am pretty new working with the Leadwerks Engine.

Want to setup a vent, that rotates.

(1) Is there a script in Lua around, that causes this?

 

Neat would be, to be able to see, in which direction the vent rotates

(To use different scripts for the ceiling or wall vents)

 

(2) How to set up the rotation speed in that script?

 

Please, might someone help me further?

That would really be great :-)

 

C.U. R.E.Z.

Leadwerks Standart Edition RTS Creator

Link to comment
Share on other sites

Aggror has a tutorial on youtube for a rotator.lua file that may work for you, here is the code...

 

angleCounter = 0

 

function Script:UpdateWorld()

--increase angle counter

angleCounter = angleCounter + (1*Time:GetSpeed())

 

--apply rotation

self.entity:SetRotation(0,0,angleCounter)

 

--Check to see if we made a full circle

if angleCounter > 360 then

self.component:CallOutputs("Done rotating")

angleCounter = 0

end

end

 

Save it as rotator.lua then attach it to the object in the script tab.

 

Hope this is helpful.

 

~Ash

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