Jump to content
R.E.Z.

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

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.

Share this post


Link to post

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

Share this post


Link to post

Hello shadmar and TemplarAsh,

 

thank You for Your help.smile.pngsmile.pngsmile.png

I did run the rotator.lua file. Works Great.

Thank You a lot.

 

Have a neat day,

 

C.U. R.E.Z.

Share this post


Link to post

Hey R.E.Z.,

 

Glad it worked for what you needed. Be sure to check out Aggror's other Lua tutorials on youtube, he is awesome.

 

~Ash

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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