Skip to content

Commit

Permalink
document ragdolldata::constrainrot
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Feb 10, 2025
1 parent 54d65b3 commit 4ea2bc5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/engine/model/ragdoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ void ragdolldata::applyrotlimit(const ragdollskel::tri &t1, const ragdollskel::t

void ragdolldata::constrainrot()
{
calctris();
calctris(); //set up shadowing matrix3 objects for skel->tris
for(const ragdollskel::rotlimit &r : skel->rotlimits)
{
matrix3 rot;
Expand All @@ -349,6 +349,7 @@ void ragdolldata::constrainrot()
vec axis;
float angle;
const float tr = rot.trace();
//calculate angle and axis from the matrix `rot`, if possible
if(tr >= r.maxtrace || !rot.calcangleaxis(tr, angle, axis))
{
continue;
Expand Down
7 changes: 7 additions & 0 deletions src/engine/model/ragdoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ class ragdolldata final
* @param axis the axis by which to rotate around
*/
void applyrotlimit(const ragdollskel::tri &t1, const ragdollskel::tri &t2, float angle, const vec &axis);

/**
* @brief Calculates and applies a rotation limit each defined rotation limit
*
* For each rotlimit in the associated skeleton, calculates the angle and rotation
* from that rotlimit and applies it to the associated vertices.
*/
void constrainrot();

/**
Expand Down

0 comments on commit 4ea2bc5

Please sign in to comment.