mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
feat: players interpolation & add hud.set_allow_pause(...)
This commit is contained in:
parent
036e13a2ca
commit
2fa71b3bf0
25 changed files with 232 additions and 41 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue