mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
add BodyType, fix crouching
This commit is contained in:
parent
7e80642ec3
commit
0a14d6220a
13 changed files with 131 additions and 34 deletions
|
|
@ -1,7 +1,27 @@
|
|||
#include "Hitbox.hpp"
|
||||
|
||||
Hitbox::Hitbox(glm::vec3 position, glm::vec3 halfsize)
|
||||
: position(position),
|
||||
#include <stdexcept>
|
||||
|
||||
std::optional<BodyType> BodyType_from(std::string_view str) {
|
||||
if (str == "kinematic") {
|
||||
return BodyType::KINEMATIC;
|
||||
} else if (str == "dynamic") {
|
||||
return BodyType::DYNAMIC;
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::string to_string(BodyType type) {
|
||||
switch (type) {
|
||||
case BodyType::KINEMATIC: return "kinematic";
|
||||
case BodyType::DYNAMIC: return "dynamic";
|
||||
default: return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
Hitbox::Hitbox(BodyType type, glm::vec3 position, glm::vec3 halfsize)
|
||||
: type(type),
|
||||
position(position),
|
||||
halfsize(halfsize),
|
||||
velocity(0.0f,0.0f,0.0f),
|
||||
linearDamping(0.1f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue