fixed the bug were the first object created was translated back to the

origin
This commit is contained in:
nicola.candussi
2008-09-24 12:40:15 +00:00
parent 752eb583d0
commit e0d1c1d057
4 changed files with 16 additions and 8 deletions

View File

@@ -120,6 +120,11 @@ dSolverCmd::redoIt()
m_dgModifier->connect(plgOutTime, plgInTime);
m_dgModifier->doIt();
}
//force update of the solver on creation
MPlug plgRigidBodies(dSolverObj, dSolverNode::oa_rigidBodies);
bool update;
plgRigidBodies.getValue(update);
setResult(MFnDependencyNode(dSolverObj).name());
return stat;

View File

@@ -421,8 +421,12 @@ void rigidBodyNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data)
vec3f pos;
quatf rot;
MFnTransform fnParentTransform(fnDagNode.parent(0));
MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform);
MStatus status;
MFnTransform fnParentTransform(fnDagNode.parent(0, &status));
MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status);
MQuaternion mrotation;
fnParentTransform.getRotation(mrotation, MSpace::kTransform);
double mscale[3];

View File

@@ -404,6 +404,9 @@ proc dynamicaUI_createRigidBody(int $active, int $collisionShapeType)
connectAttr ($selection[$i * 2] + ".message") ($collisionShapeNode + ".inShape");
hide $shapeTransforms[0];
}
setAttr ($rigidBodyNode + ".active" ) $active;
setAttr ($collisionShapeNode + ".type" ) $collisionShapeType;
float $pos[]= `getAttr ($shapeTransforms[0] + ".translate")`;
float $rot[]= `getAttr ($shapeTransforms[0] + ".rotate")`;
@@ -413,9 +416,6 @@ proc dynamicaUI_createRigidBody(int $active, int $collisionShapeType)
setAttr ($rigidBodyTransforms[0] + ".rotate") -type double3 $rot[0] $rot[1] $rot[2];
// setAttr ($rigidBodyNode + ".initialRotation") -type double3 $rot[0] $rot[1] $rot[2];
setAttr ($rigidBodyNode + ".active" ) $active;
setAttr ($collisionShapeNode + ".type" ) $collisionShapeType;
$newBodies[$i] = $rigidBodyTransforms[0];
}
} else {
@@ -426,7 +426,6 @@ proc dynamicaUI_createRigidBody(int $active, int $collisionShapeType)
setAttr ($rigidBodyNode + ".active" ) $active;
setAttr ($collisionShapeNode + ".type" ) $collisionShapeType;
$newBodies[0] = $rigidBodyTransforms[0];
}