Skip to content

Commit

Permalink
move collidewall out of ragdolldata::constrain
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Jan 14, 2025
1 parent f8470d5 commit 8b4637a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/engine/model/ragdoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ void ragdolldata::tryunstick(float speed)
}
}

void ragdolldata::constrain()
void ragdolldata::constrain(const vec &cwall)
{
static VAR(ragdollconstrain, 1, 7, 100); //number of iterations to run ragdolldata::constrain() for
//note: this for loop does not use the loop variable `i` anywhere
Expand Down Expand Up @@ -481,10 +481,10 @@ void ragdolldata::constrain()
if(v.pos != v.undo && collidevert(v.pos, vec(v.pos).sub(v.undo), skel->verts[j].radius))
{
vec dir = vec(v.pos).sub(v.oldpos);
const float facing = dir.dot(collidewall);
const float facing = dir.dot(cwall);
if(facing < 0)
{
v.oldpos = vec(v.undo).sub(dir.msub(collidewall, 2*facing));
v.oldpos = vec(v.undo).sub(dir.msub(cwall, 2*facing));
}
v.pos = v.undo;
v.collided = true;
Expand Down Expand Up @@ -564,7 +564,7 @@ void ragdolldata::move(bool water, float ts)
{
collidemillis = 0;
}
constrain();
constrain(collidewall);
calctris();
calcboundsphere();
}
Expand Down
2 changes: 1 addition & 1 deletion src/engine/model/ragdoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class ragdolldata final
* the vertex array.
*/
void calcboundsphere();
void constrain();
void constrain(const vec &cwall);
void constraindist();

/**
Expand Down

0 comments on commit 8b4637a

Please sign in to comment.