'vbscript example that demonstrates how Envelope indices are mapped
'to indices of the points on the Geometry via the Envelope.Elements property
newscene ,false
set oSphere = ActiveSceneRoot.AddGeometry( "Sphere", "MeshSurface" )
'Create a cluster that only contains some of the points.
'These are the only points that will be inflenced by the skeleton
set oCluster = oSphere.ActivePrimitive.Geometry.AddCluster( _
siVertexCluster, "MyFrontPoints", Array( 5,10,12 ) )
'Create the skeleton
set oChainRoot = ActiveSceneRoot.Add3DChain
set oEnvelope = oCluster.ApplyEnvelope( oChainRoot, siBranch )
aWeights = oEnvelope.Weights.Array
for iElement=lbound(aWeights,2) to ubound(aWeights,2)
'Calculate the index of the point that corresponds to this
'index in the cluster
iVertex = oEnvelope.Elements.Item( iElement )
logmessage "Envelope Weight " & iElement & _
" refers to point " & iVertex & " on the Geometry"
next
'Output of this script is:
'INFO : "Envelope Weight 0 refers to point 5 on the Geometry"
'INFO : "Envelope Weight 1 refers to point 10 on the Geometry"
'INFO : "Envelope Weight 2 refers to point 12 on the Geometry" |