mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add core:mob component & move player movement to scripting
This commit is contained in:
parent
67ef84d6b0
commit
dfb83f6835
10 changed files with 132 additions and 100 deletions
|
|
@ -25,7 +25,7 @@ void PhysicsSolver::step(
|
|||
entityid_t entity
|
||||
) {
|
||||
float dt = delta / static_cast<float>(substeps);
|
||||
float linearDamping = hitbox.linearDamping;
|
||||
float linearDamping = hitbox.linearDamping * hitbox.friction;
|
||||
float s = 2.0f/BLOCK_AABB_GRID;
|
||||
|
||||
const glm::vec3& half = hitbox.halfsize;
|
||||
|
|
@ -45,11 +45,11 @@ void PhysicsSolver::step(
|
|||
colisionCalc(chunks, hitbox, vel, pos, half,
|
||||
(prevGrounded && gravityScale > 0.0f) ? 0.5f : 0.0f);
|
||||
}
|
||||
vel.x *= glm::max(0.0f, 1.0f - dt * linearDamping);
|
||||
vel.x /= 1.0f + dt * linearDamping;
|
||||
vel.z /= 1.0f + dt * linearDamping;
|
||||
if (hitbox.verticalDamping) {
|
||||
vel.y *= glm::max(0.0f, 1.0f - dt * linearDamping);
|
||||
vel.y /= 1.0f + dt * linearDamping;
|
||||
}
|
||||
vel.z *= glm::max(0.0f, 1.0f - dt * linearDamping);
|
||||
|
||||
pos += vel * dt + gravity * gravityScale * dt * dt * 0.5f;
|
||||
if (hitbox.grounded && pos.y < py) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue