private static void AddMotor(Ragdoll ragdoll, AvatarBone parentBone, AvatarBone childBone) { // A quaternion motor controls the relative orientation between two bodies. The target // orientation is specified with a quaternion. The target orientations are set in // SetMotorTargets. // We can use the motors to achieve following results: // - No motors: The ragdoll joints are not damped and the bones swing a lot (within the // allowed limits). // - Damping: If DampingConstant > 0 and SpringConstant == 0, the relative bone rotations // are damped. This simulates joint friction and muscles forces acting against the movement. // - Springs: If DampingConstant > 0 and SpringConstant > 0, the motors try to move the // ragdoll limbs to a pose defined by the TargetOrientations of the motors. This could be, // for example, a defensive pose of a character. // - Animation: Like "Springs" but the TargetOrientation is changed in each frame. This // way the ragdoll performs a user defined animation while still reacting to impacts. int parentIndex = (int)parentBone; int childIndex = (int)childBone; var motor = new RagdollMotor(childIndex, parentIndex); ragdoll.Motors[childIndex] = motor; }
private static void AddMotor(Ragdoll ragdoll, AvatarBone parentBone, AvatarBone childBone) { // A quaternion motor controls the relative orientation between two bodies. The target // orientation is specified with a quaternion. The target orientations are set in // SetMotorTargets. // We can use the motors to achieve following results: // - No motors: The ragdoll joints are not damped and the bones swing a lot (within the // allowed limits). // - Damping: If DampingConstant > 0 and SpringConstant == 0, the relative bone rotations // are damped. This simulates joint friction and muscles forces acting against the movement. // - Springs: If DampingConstant > 0 and SpringConstant > 0, the motors try to move the // ragdoll limbs to a pose defined by the TargetOrientations of the motors. This could be, // for example, a defensive pose of a character. // - Animation: Like "Springs" but the TargetOrientation is changed in each frame. This // way the ragdoll performs a user defined animation while still reacting to impacts. int parentIndex = (int)parentBone; int childIndex = (int)childBone; var motor = new RagdollMotor(childIndex, parentIndex); ragdoll.Motors[childIndex] = motor; }