add core:mob component & move player movement to scripting
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user