Entity.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef ENTITY_H
  2. #define ENTITY_H
  3. #include "common/Box.h"
  4. #include "math/Quaternion.h"
  5. struct Entity {
  6. Vector3 lastPosition;
  7. Vector3 position;
  8. float lastLengthAngle;
  9. float lengthAngle;
  10. float lastWidthAngle;
  11. float widthAngle;
  12. Vector3 velocity;
  13. Vector3 acceleration;
  14. Vector3 size;
  15. Vector3 drag;
  16. float speed;
  17. float jumpPower;
  18. bool onGround;
  19. bool skip;
  20. Entity();
  21. virtual ~Entity() = default;
  22. virtual void tick();
  23. void addForce(const Vector3& force);
  24. const Vector3& getVelocity() const;
  25. void move(const Vector3& v);
  26. Box getBox() const;
  27. bool isOnGround() const;
  28. void setPosition(const Vector3& pos);
  29. void setPosition(const Vector3& pos, float lengthAngle, float widthAngle);
  30. Vector3 getRenderPosition(float lag) const;
  31. Quaternion getRotation() const;
  32. Quaternion getRenderRotation(float lag) const;
  33. void addLengthAngle(float angle);
  34. void addWidthAngle(float angle);
  35. float getMaxXZVelocity() const;
  36. void jump();
  37. };
  38. #endif