update 'hitbox' property semantics
This commit is contained in:
parent
37f28a768c
commit
91230ecbeb
@ -2,7 +2,7 @@
|
|||||||
"components": [
|
"components": [
|
||||||
"drop"
|
"drop"
|
||||||
],
|
],
|
||||||
"hitbox": [0.2, 0.125, 0.2],
|
"hitbox": [0.4, 0.25, 0.4],
|
||||||
"sensors": [
|
"sensors": [
|
||||||
["aabb", -0.2, -0.2, -0.2, 0.2, 0.2, 0.2],
|
["aabb", -0.2, -0.2, -0.2, 0.2, 0.2, 0.2],
|
||||||
["radius", 1.6]
|
["radius", 1.6]
|
||||||
|
|||||||
@ -3,5 +3,5 @@
|
|||||||
"falling_block"
|
"falling_block"
|
||||||
],
|
],
|
||||||
"rig-name": "base:block",
|
"rig-name": "base:block",
|
||||||
"hitbox": [0.4, 0.4, 0.4]
|
"hitbox": [0.8, 0.8, 0.8]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"hitbox": [0.3, 0.9, 0.3]
|
"hitbox": [0.6, 1.8, 0.6]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -143,9 +143,10 @@ void CameraControl::switchCamera() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CameraControl::update(const PlayerInput& input, float delta, Chunks* chunks) {
|
void CameraControl::update(const PlayerInput& input, float delta, Chunks* chunks) {
|
||||||
offset = glm::vec3(0.0f, 0.7f, 0.0f);
|
offset = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
if (auto hitbox = player->getHitbox()) {
|
if (auto hitbox = player->getHitbox()) {
|
||||||
|
offset.y += hitbox->halfsize.y * (0.7f/0.9f);
|
||||||
if (settings.shaking.get() && !input.cheat) {
|
if (settings.shaking.get() && !input.cheat) {
|
||||||
offset += updateCameraShaking(*hitbox, delta);
|
offset += updateCameraShaking(*hitbox, delta);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -85,7 +85,7 @@ entityid_t Entities::spawn(
|
|||||||
const auto& tsf = registry.emplace<Transform>(
|
const auto& tsf = registry.emplace<Transform>(
|
||||||
entity, position, glm::vec3(1.0f), glm::mat3(1.0f), glm::mat4(1.0f), true);
|
entity, position, glm::vec3(1.0f), glm::mat3(1.0f), glm::mat4(1.0f), true);
|
||||||
auto& body = registry.emplace<Rigidbody>(
|
auto& body = registry.emplace<Rigidbody>(
|
||||||
entity, true, Hitbox {def.bodyType, position, def.hitbox}, std::vector<Sensor>{});
|
entity, true, Hitbox {def.bodyType, position, def.hitbox*0.5f}, std::vector<Sensor>{});
|
||||||
|
|
||||||
body.sensors.resize(def.radialSensors.size() + def.boxSensors.size());
|
body.sensors.resize(def.radialSensors.size() + def.boxSensors.size());
|
||||||
for (auto& [i, box] : def.boxSensors) {
|
for (auto& [i, box] : def.boxSensors) {
|
||||||
|
|||||||
@ -20,7 +20,7 @@ struct EntityDef {
|
|||||||
std::vector<std::string> components;
|
std::vector<std::string> components;
|
||||||
|
|
||||||
BodyType bodyType = BodyType::DYNAMIC;
|
BodyType bodyType = BodyType::DYNAMIC;
|
||||||
glm::vec3 hitbox {0.5f};
|
glm::vec3 hitbox {0.25f};
|
||||||
std::vector<std::pair<size_t, AABB>> boxSensors {};
|
std::vector<std::pair<size_t, AABB>> boxSensors {};
|
||||||
std::vector<std::pair<size_t, float>> radialSensors {};
|
std::vector<std::pair<size_t, float>> radialSensors {};
|
||||||
std::string rigName = name;
|
std::string rigName = name;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user