mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 11:31:49 +00:00
move Chunks from Level to Player
This commit is contained in:
parent
b7664b4188
commit
1c18c02092
40 changed files with 450 additions and 220 deletions
|
|
@ -459,7 +459,7 @@ void Entities::updatePhysics(float delta) {
|
|||
float vel = glm::length(prevVel);
|
||||
int substeps = static_cast<int>(delta * vel * 20);
|
||||
substeps = std::min(100, std::max(2, substeps));
|
||||
physics->step(level->chunks.get(), &hitbox, delta, substeps, eid.uid);
|
||||
physics->step(*level->chunksStorage, &hitbox, delta, substeps, eid.uid);
|
||||
hitbox.linearDamping = hitbox.grounded * 24;
|
||||
transform.setPos(hitbox.position);
|
||||
if (hitbox.grounded && !grounded) {
|
||||
|
|
|
|||
|
|
@ -205,12 +205,12 @@ void Player::attemptToFindSpawnpoint() {
|
|||
position.z + (rand() % 200 - 100)
|
||||
);
|
||||
while (newpos.y > 0 &&
|
||||
!level->chunks->isObstacleBlock(newpos.x, newpos.y - 2, newpos.z)) {
|
||||
!chunks->isObstacleBlock(newpos.x, newpos.y - 2, newpos.z)) {
|
||||
newpos.y--;
|
||||
}
|
||||
|
||||
voxel* headvox = level->chunks->get(newpos.x, newpos.y + 1, newpos.z);
|
||||
if (level->chunks->isObstacleBlock(newpos.x, newpos.y, newpos.z) ||
|
||||
voxel* headvox = chunks->get(newpos.x, newpos.y + 1, newpos.z);
|
||||
if (chunks->isObstacleBlock(newpos.x, newpos.y, newpos.z) ||
|
||||
headvox == nullptr || headvox->id != 0) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue