Benchmark02_WomanMover.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #include <Urho3D/Scene/LogicComponent.h>
  5. #include <Urho3D/Math/BoundingBox.h>
  6. namespace U3D = Urho3D;
  7. // Custom logic component for moving the animated model and rotating at area edges
  8. class Benchmark02_WomanMover : public U3D::LogicComponent
  9. {
  10. public:
  11. URHO3D_OBJECT(Benchmark02_WomanMover, LogicComponent);
  12. private:
  13. // Forward movement speed
  14. float moveSpeed_;
  15. // Rotation speed
  16. float rotationSpeed_;
  17. // Movement boundaries
  18. U3D::BoundingBox bounds_;
  19. public:
  20. explicit Benchmark02_WomanMover(U3D::Context* context);
  21. // Set motion parameters: forward movement speed, rotation speed, and movement boundaries
  22. void SetParameters(float moveSpeed, float rotationSpeed, const U3D::BoundingBox& bounds);
  23. // Handle scene update. Called by LogicComponent base class
  24. void Update(float timeStep) override;
  25. // Return forward movement speed
  26. float GetMoveSpeed() const { return moveSpeed_; }
  27. // Return rotation speed
  28. float GetRotationSpeed() const { return rotationSpeed_; }
  29. // Return movement boundaries
  30. const U3D::BoundingBox& GetBounds() const { return bounds_; }
  31. };