mirror of
https://github.com/lubosz/overte.git
synced 2025-04-25 00:03:16 +02:00
Merge pull request #3264 from AndrewMeadows/ragdoll
fix for bad models and some crashes
This commit is contained in:
commit
0f5ee4eac1
2 changed files with 1 additions and 27 deletions
|
@ -206,7 +206,7 @@ void MyAvatar::simulate(float deltaTime) {
|
|||
{
|
||||
PerformanceTimer perfTimer("ragdoll");
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::CollideAsRagdoll)) {
|
||||
const int minError = 0.01f;
|
||||
const float minError = 0.01f;
|
||||
const float maxIterations = 10;
|
||||
const quint64 maxUsec = 2000;
|
||||
_physicsSimulation.setTranslation(_position);
|
||||
|
|
|
@ -188,34 +188,8 @@ void Model::initSkinProgram(ProgramObject& program, Model::SkinLocations& locati
|
|||
|
||||
QVector<JointState> Model::createJointStates(const FBXGeometry& geometry) {
|
||||
QVector<JointState> jointStates;
|
||||
QVector<int> roots;
|
||||
roots.fill(-1, geometry.joints.size());
|
||||
for (int i = 0; i < geometry.joints.size(); ++i) {
|
||||
const FBXJoint& joint = geometry.joints[i];
|
||||
int parentIndex = joint.parentIndex;
|
||||
|
||||
// Some models may have multiple roots (?!), but these are causing problems in
|
||||
// the Avatar Ragdoll simulation, so we prune them out of the JointState tree.
|
||||
int rootIndex = 0;
|
||||
if (parentIndex == -1) {
|
||||
if (i != 0) {
|
||||
// skip other root
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
rootIndex = roots[parentIndex];
|
||||
if (rootIndex == -1) {
|
||||
roots[i] = parentIndex;
|
||||
rootIndex = parentIndex;
|
||||
} else {
|
||||
roots[i] = rootIndex;
|
||||
}
|
||||
if (rootIndex != 0) {
|
||||
// skip child of other root
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// store a pointer to the FBXJoint in the JointState
|
||||
JointState state;
|
||||
state.setFBXJoint(&joint);
|
||||
|
|
Loading…
Reference in a new issue