Add options for position/velocity solver iterations config for ragdolls
This commit is contained in:
@@ -39,6 +39,9 @@ float Ragdoll::InitBone(RigidBody* rigidBody, int32& nodeIndex, Transform& local
|
|||||||
node.Decompose(nodeT);
|
node.Decompose(nodeT);
|
||||||
localOffset = nodeT.WorldToLocal(rigidBody->GetLocalTransform());
|
localOffset = nodeT.WorldToLocal(rigidBody->GetLocalTransform());
|
||||||
_bonesOffsets[rigidBody] = localOffset;
|
_bonesOffsets[rigidBody] = localOffset;
|
||||||
|
|
||||||
|
// Initialize body
|
||||||
|
rigidBody->SetSolverIterationCounts(PositionSolverIterations, VelocitySolverIterations);
|
||||||
}
|
}
|
||||||
return weight;
|
return weight;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,20 @@ public:
|
|||||||
API_FIELD(Attributes="EditorOrder(20), EditorDisplay(\"Ragdoll\")")
|
API_FIELD(Attributes="EditorOrder(20), EditorDisplay(\"Ragdoll\")")
|
||||||
Dictionary<String, float> BonesWeights;
|
Dictionary<String, float> BonesWeights;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum number of position iterations the physics solver should perform for bodies in this ragdoll. Higher values improve stability but affect performance.
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="RigidBody.SetSolverIterationCounts"/>
|
||||||
|
API_FIELD(Attributes="EditorOrder(100), EditorDisplay(\"Ragdoll\"), Limit(1, 255)")
|
||||||
|
uint8 PositionSolverIterations = 8;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The minimum number of velocity iterations the physics solver should perform for bodies in this ragdoll. Higher values improve stability but affect performance.
|
||||||
|
/// </summary>
|
||||||
|
/// <seealso cref="RigidBody.SetSolverIterationCounts"/>
|
||||||
|
API_FIELD(Attributes="EditorOrder(100), EditorDisplay(\"Ragdoll\"), Limit(1, 255)")
|
||||||
|
uint8 VelocitySolverIterations = 2;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user