Rotator.lua 542 B

1234567891011121314151617
  1. -- Rotator script object class. Script objects to be added to a scene node must implement the empty ScriptObject interface
  2. Rotator = ScriptObject()
  3. function Rotator:Start()
  4. self.rotationSpeed = Vector3(0, 0, 0)
  5. end
  6. function Rotator:SetRotationSpeed(speed)
  7. self.rotationSpeed = Vector3(speed)
  8. end
  9. function Rotator:Update(timeStep)
  10. local x = self.rotationSpeed.x * timeStep
  11. local y = self.rotationSpeed.y * timeStep
  12. local z = self.rotationSpeed.z * timeStep
  13. self.node:Rotate(Quaternion(x, y, z))
  14. end