A few notes on Houdini Crowd Simulations

Tags

, ,

** Ensure your collisions layers have a sensible and accurate representation.
** Ensure your ‘agent configure joint’ has a sensible and accurate representation of rotation limits.
** A Ragdoll sim is a crowd solver/bullet solver hybrid with the bullet solver controlling the ragdoll behaviour.
** The heading and up vectors are used to ensure the initial orientation of the agents.
** If you have an initial velocity, it overrides the heading.
*Calculate the orient attribute from normals:
matrix3 m = dihedral({0,1,1},@N);
@orient = quaternion(m);
*Calculate the heading and up vectors from the orient attribute:
matrix3 rr = qconvert(@orient);
v@up = set(rr.yx,rr.yy,rr.yz);
v@heading = set(rr.zx,rr.zy,rr.zz);
* Agent attributes can directly be modified during a simulation within a sopsolver.
* Increasing the number of substeps on the bullet solver helps with weird stretching of ragdolls.
**WHY use the Hard Constraint Relationship(usually Pin Constraint) and the Cone Twist Constraint Relationship Hybrid? ** Taken from houdini documentation: “The rotation limits set up by the Agent Configure Joints node will be used to set up cone twist constraints. For any transforms where the rotation limits were not set (or if there are multiple root collision shapes), pin constraints will be created to prevent the ragdoll from immediately separating.” ** Because constraint attributes set in SOPs act as multipliers to the DOP parameters with the same names, a good workflow is to set the DOP parameters to one and set the desired values with the matching SOPs attributes. ** REDUCING THE “ERROR REDUCTION PARAMETER” ON THE HARD CONSTRAINT RELATIONSHIP seems to get rid of the undesired stretching of ragdolls.
The following VEX code is for initializing basic agent attributes:
vector @v_agent[];
vector @w_agent[];
vector v = chv("vel");
vector w = radians(chv("angvel"));
int n = agenttransformcount(0, @primnum);
for (int i = 0; i < n; ++i)
{
    append(@v_agent, v);
    append(@w_agent, w);
}

//Primitive attributes set on the constraint network
 @softness = chf("softness");
 @max_up_rotation=chf("max_up_rotation");
 @max_out_rotation=chf("max_out_rotation");
 @cfm = chf("constraint_force_mixing");
 @bias_factor = chf("bias_factor");
 @relaxation_factor = chf("relaxation_factor");