Rotator.h 818 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include <Urho3D/Scene/LogicComponent.h>
  5. // All Urho3D classes reside in namespace Urho3D
  6. using namespace Urho3D;
  7. /// Custom logic component for rotating a scene node.
  8. class Rotator : public LogicComponent
  9. {
  10. URHO3D_OBJECT(Rotator, LogicComponent);
  11. public:
  12. /// Construct.
  13. explicit Rotator(Context* context);
  14. /// Set rotation speed about the Euler axes. Will be scaled with scene update time step.
  15. void SetRotationSpeed(const Vector3& speed);
  16. /// Handle scene update. Called by LogicComponent base class.
  17. void Update(float timeStep) override;
  18. /// Return rotation speed.
  19. const Vector3& GetRotationSpeed() const { return rotationSpeed_; }
  20. private:
  21. /// Rotation speed.
  22. Vector3 rotationSpeed_;
  23. };