feat: players interpolation & add hud.set_allow_pause(...)

This commit is contained in:
MihailRis
2025-01-17 01:44:46 +03:00
parent 036e13a2ca
commit 2fa71b3bf0
25 changed files with 232 additions and 41 deletions
+13
View File
@@ -181,6 +181,7 @@ void Player::teleport(glm::vec3 position) {
if (auto entity = level.entities->get(eid)) {
entity->getRigidbody().hitbox.position = position;
entity->getTransform().setPos(position);
entity->setInterpolatedPosition(position);
}
}
@@ -296,6 +297,18 @@ glm::vec3 Player::getSpawnPoint() const {
return spawnpoint;
}
glm::vec3 Player::getRotation(bool interpolated) const {
if (interpolated) {
return rotationInterpolation.getCurrent();
}
return rotation;
}
void Player::setRotation(const glm::vec3& rotation) {
this->rotation = rotation;
rotationInterpolation.refresh(rotation);
}
dv::value Player::serialize() const {
auto root = dv::object();