mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add BodyType, fix crouching
This commit is contained in:
parent
7e80642ec3
commit
0a14d6220a
13 changed files with 131 additions and 34 deletions
|
|
@ -21,8 +21,6 @@ void PhysicsSolver::step(
|
|||
Hitbox* hitbox,
|
||||
float delta,
|
||||
uint substeps,
|
||||
bool shifting,
|
||||
bool collisions,
|
||||
entityid_t entity
|
||||
) {
|
||||
float dt = delta / static_cast<float>(substeps);
|
||||
|
|
@ -42,7 +40,7 @@ void PhysicsSolver::step(
|
|||
float pz = pos.z;
|
||||
|
||||
vel += gravity * dt * gravityScale;
|
||||
if (collisions) {
|
||||
if (hitbox->type == BodyType::DYNAMIC) {
|
||||
colisionCalc(chunks, hitbox, vel, pos, half,
|
||||
(prevGrounded && gravityScale > 0.0f) ? 0.5f : 0.0f);
|
||||
}
|
||||
|
|
@ -57,7 +55,7 @@ void PhysicsSolver::step(
|
|||
pos.y = py;
|
||||
}
|
||||
|
||||
if (shifting && hitbox->grounded){
|
||||
if (hitbox->crouching && hitbox->grounded){
|
||||
float y = (pos.y-half.y-E);
|
||||
hitbox->grounded = false;
|
||||
for (float x = (px-half.x+E); x <= (px+half.x-E); x+=s){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue