Dynamica Maya plugin changes to take into account scale and pivot point offset
when converting existing objects to convex hull or mesh One more method added to set spring equilibrium point directly for btGeneric6DofSpringConstraint
This commit is contained in:
@@ -458,8 +458,19 @@ proc dynamicaUI_createRigidBody(int $activebody, int $collisionShapeType)
|
||||
setAttr ($rigidBodyNode + ".mass" ) $mass;
|
||||
setAttr ($collisionShapeNode + ".type" ) $collisionShapeType;
|
||||
|
||||
float $pos[]= `getAttr ($shapeTransforms[0] + ".translate")`;
|
||||
float $rot[]= `getAttr ($shapeTransforms[0] + ".rotate")`;
|
||||
float $wmatr[]= `getAttr ($shapeTransforms[0] + ".worldMatrix")`;
|
||||
// float $pos[]= `getAttr ($shapeTransforms[0] + ".translate")`;
|
||||
// We need to take into account offset of the pivot point
|
||||
// so get the final translation directly from world matrix
|
||||
// also get existing scale
|
||||
// note that this may not work if scaling coordinate system differs from object's coordinate system
|
||||
// Bullet does not support that yet
|
||||
float $pos[];
|
||||
$pos[0] = $wmatr[12];
|
||||
$pos[1] = $wmatr[13];
|
||||
$pos[2] = $wmatr[14];
|
||||
float $scale[] = `getAttr ($shapeTransforms[0] + ".scale")`;
|
||||
|
||||
setAttr ($rigidBodyTransforms[0] + ".translate") -type double3 $pos[0] $pos[1] $pos[2];
|
||||
setAttr ($rigidBodyNode + ".initialPosition") -type double3 $pos[0] $pos[1] $pos[2];
|
||||
@@ -467,6 +478,9 @@ proc dynamicaUI_createRigidBody(int $activebody, 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 ($rigidBodyTransforms[0] + ".scale") -type double3 $scale[0] $scale[1] $scale[2];
|
||||
setAttr ($collisionShapeNode + ".scale" ) -type double3 $scale[0] $scale[1] $scale[2];
|
||||
|
||||
$newBodies[$i] = $rigidBodyTransforms[0];
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user