mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
add BodyType, fix crouching
This commit is contained in:
parent
7e80642ec3
commit
0a14d6220a
13 changed files with 131 additions and 34 deletions
|
|
@ -5,6 +5,8 @@
|
|||
#include "../typedefs.hpp"
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <optional>
|
||||
#include <functional>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
|
|
@ -36,7 +38,15 @@ struct Trigger {
|
|||
triggercallback exitCallback;
|
||||
};
|
||||
|
||||
enum class BodyType {
|
||||
KINEMATIC, DYNAMIC
|
||||
};
|
||||
|
||||
std::optional<BodyType> BodyType_from(std::string_view str);
|
||||
std::string to_string(BodyType type);
|
||||
|
||||
struct Hitbox {
|
||||
BodyType type;
|
||||
glm::vec3 position;
|
||||
glm::vec3 halfsize;
|
||||
glm::vec3 velocity;
|
||||
|
|
@ -44,8 +54,9 @@ struct Hitbox {
|
|||
bool verticalDamping = false;
|
||||
bool grounded = false;
|
||||
float gravityScale = 1.0f;
|
||||
bool crouching = false;
|
||||
|
||||
Hitbox(glm::vec3 position, glm::vec3 halfsize);
|
||||
Hitbox(BodyType type, glm::vec3 position, glm::vec3 halfsize);
|
||||
};
|
||||
|
||||
#endif // PHYSICS_HITBOX_HPP_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue