CofMA3 V3 V4

scripts that compute the center of mass of Aiko3, Victoria 3 and Victoria 4

these scripts worked for Daz Studio 2 and maybe !, and may work fine with Daz studio 3

CofMV3.ds, CofMV4.ds and CofMA3.ds


 


Download : see the attachments at the bottom of this page

the zip contains the script and the associated icon, typically you should unzip this in your

c:\program files\daz\studio\content\scripts

The weights were guesstimated using the volume of the bounding boxes of each bone as reported by daz studio

Usage:

- select a human figure
- select an object, example a sphere
- run the script

the selected object should jump to the location of figure's center of mass

often times you'll want to put Vickie or Aiko's feet right below the center of mass so they can keep their balance Smile


The script below, computes the center of gravity of V4 based on the positions and weights of her body parts.

This script should also work for figures that comprise the following bone names:

hip
abdomen
chest
neck
head
rCollar
rShldr
rForeArm
rHand
lCollar
lShldr
lForeArm
lHand
rThigh
rShin
rFoot
lThigh
lShin
lFoot

if you adapt this script to other figures, it's crucial that the sum of the weights in your list of bones/weights match the value of the variable named "totalweight"

<HR>


Code:

//======================================================
// usage:
// -- select a human figure
// -- select an object example, a sphere
// -- launch the script

// the object should move to the position of the center of mass of the figure
// this works only if all the body parts listed below are present for this figure

//======================================================
//note totalweight must be exactly equal to the sum
// of the weights listed in computecenofgravity()
var totalweight = 50000; //50 Kg or 110 lbs

skel = Scene.getSelectedNode(0).getSkeleton()
       
var cofm = new DzVec3( 0, 0, 0 );

computecenofgravity( skel )
   
App.statusLine( "( " + cofm.x + "," + cofm.y + "," + cofm.z + " )" )

var node = Scene.getSelectedNode( 1 );

if( node )
{
    node.setWSPos( cofm )
}

//======================================================
//
//======================================================
function addweight( name, weight )
{
    var bone = skel.findBone( name );
    if( bone )
    {
   var cen = bone.getWSBoundingBox().getCenter();
   cofm.x = cofm.x + cen.x * weight / totalweight;
   cofm.y = cofm.y + cen.y * weight / totalweight;
   cofm.z = cofm.z + cen.z * weight / totalweight;
    }
}

//======================================================
//
//======================================================
function computecenofgravity()
{
addweight( "hip", 5800 );
addweight( "abdomen", 5800 );
addweight( "chest", 5800 );
addweight( "neck", 1300 );
addweight( "head", 3000 );
addweight( "rCollar", 2000 );
addweight( "rShldr", 1000 );
addweight( "rForeArm", 680 );
addweight( "rHand", 350 );
addweight( "lCollar", 2000 );
addweight( "lShldr", 1000 );
addweight( "lForeArm", 680 );
addweight( "lHand", 350 );
addweight( "rThigh", 6000 );
addweight( "rShin", 3440 );
addweight( "rFoot", 680 );
addweight( "lThigh", 6000 );
addweight( "lShin", 3440 );
addweight( "lFoot", 680 );
}





===============================================
below is the source code of CofMA3.ds

The script below, computes the center of gravity of A3 based on the positions and weights of her body parts.

This script should also work for figures that comprise the following bone names:

hip
abdomen
chest
neck
head
rCollar
rShldr
rForeArm
rHand
lCollar
lShldr
lForeArm
lHand
rButtock
rThigh
rShin
rFoot
lButtock
lThigh
lShin
lFoot

if you adapt this script to other figures, it's crucial that the sum of the weights in your list of bones/weights match the value of the variable named "totalweight"

===============================================


Code:

//======================================================
// usage:
// -- select a human figure ( designed for Aiko3 )
// -- select an object example, a sphere
// -- launch the script

// the object should move to the position of the center of mass of the figure
// this works only if all the body parts listed below are present for this figure

//======================================================
//note totalweight must be exactly equal to the sum
// of the weights listed in computecenofgravity()
var totalweight = 50000; //50 Kg or 110 lbs

skel = Scene.getSelectedNode(0).getSkeleton()
       
var cofm = new DzVec3( 0, 0, 0 );

computecenofgravity( skel )
   
App.statusLine( "( " + cofm.x + "," + cofm.y + "," + cofm.z + " )" )

var node = Scene.getSelectedNode( 1 );

if( node )
{
    node.setWSPos( cofm )
}

//======================================================
//
//======================================================
function addweight( name, weight )
{
    var bone = skel.findBone( name );
    if( bone )
    {
   var cen = bone.getWSBoundingBox().getCenter();
   cofm.x = cofm.x + cen.x * weight / totalweight;
   cofm.y = cofm.y + cen.y * weight / totalweight;
   cofm.z = cofm.z + cen.z * weight / totalweight;
    }
}

//======================================================
//
//======================================================
function computecenofgravity()
{
addweight( "hip", 4100 );
addweight( "abdomen", 2500 );
addweight( "chest", 5500 );
addweight( "neck", 600 );
addweight( "head", 3700 );
addweight( "rCollar", 5000 );
addweight( "rShldr", 900 );
addweight( "rForeArm", 1000 );
addweight( "rHand", 300 );
addweight( "lCollar", 5000 );
addweight( "lShldr", 900 );
addweight( "lForeArm", 1000 );
addweight( "lHand", 300 );
addweight( "rButtock", 4200 );
addweight( "rThigh", 2200 );
addweight( "rShin", 2600 );
addweight( "rFoot", 600 );
addweight( "lButtock", 4200 );
addweight( "lThigh", 2200 );
addweight( "lShin", 2600 );
addweight( "lFoot", 600 );
}


===============================================
below is the source code of CofMV3.ds

The script below, computes the center of gravity of V3 based on the positions and weights of her body parts.

This script should also work for figures that comprise the following bone names:

hip
abdomen
chest
neck
head
rCollar
rShldr
rForeArm
rHand
lCollar
lShldr
lForeArm
lHand
rButtock
rThigh
rShin
rFoot
lButtock
lThigh
lShin
lFoot


if you adapt this script to other figures, it's crucial that the sum of the weights in your list of bones/weights match the value of the variable named "totalweight"

===============================================


Code:

//======================================================
// usage:
// -- select a human figure ( designed for Victoria3 )
// -- select an object example, a sphere
// -- launch the script

// the object should move to the position of the center of mass of the figure
// this works only if all the body parts listed below are present for this figure

//======================================================
//note totalweight must be exactly equal to the sum
// of the weights listed in computecenofgravity()
var totalweight = 50000; //50 Kg or 110 lbs

skel = Scene.getSelectedNode(0).getSkeleton()
       
var cofm = new DzVec3( 0, 0, 0 );

computecenofgravity( skel )
   
App.statusLine( "( " + cofm.x + "," + cofm.y + "," + cofm.z + " )" )

var node = Scene.getSelectedNode( 1 );

if( node )
{
    node.setWSPos( cofm )
}

//======================================================
//
//======================================================
function addweight( name, weight )
{
    var bone = skel.findBone( name );
    if( bone )
    {
   var cen = bone.getWSBoundingBox().getCenter();
   cofm.x = cofm.x + cen.x * weight / totalweight;
   cofm.y = cofm.y + cen.y * weight / totalweight;
   cofm.z = cofm.z + cen.z * weight / totalweight;
    }
}

//======================================================
//
//======================================================
function computecenofgravity()
{
addweight( "hip", 5370 );
addweight( "abdomen", 3200 );
addweight( "chest", 6200 );
addweight( "neck", 600 );
addweight( "head", 2090 );
addweight( "rCollar", 4900 );
addweight( "rShldr", 900 );
addweight( "rForeArm", 950 );
addweight( "rHand", 250 );
addweight( "lCollar", 4900 );
addweight( "lShldr", 900 );
addweight( "lForeArm", 950 );
addweight( "lHand", 250 );
addweight( "rButtock", 4020 );
addweight( "rThigh", 2500 );
addweight( "rShin", 2300 );
addweight( "rFoot", 450 );
addweight( "lButtock", 4020 );
addweight( "lThigh", 2500 );
addweight( "lShin", 2300 );
addweight( "lFoot", 450 );
}

ċ
mCasual Jacques,
Jan 12, 2010, 11:03 AM
ċ
mCasual Jacques,
Jan 12, 2010, 11:03 AM
ċ
mCasual Jacques,
Jan 12, 2010, 11:03 AM
Comments