/*
This example creates a thigh slide setup on a one bone chain.
MakeThighSlide needs a collection of five guide objects as an argument.
Build a collection of five guide nulls and position them.
*/
var guidecoll = new ActiveXObject("XSI.Collection");
guidecoll.Add( GetPrim("Null", "SlideTop") );
guidecoll.Add( GetPrim("Null", "SlideBottom") );
guidecoll.Add( GetPrim("Null", "SlideSideHip") );
guidecoll.Add( GetPrim("Null", "SlideThighLeg") );
guidecoll.Add( GetPrim("Null", "SlideThighKnee") );
//
// Make the slide control nulls red
//
MakeLocal(guidecoll(0)+".display", siDefaultPropagation);
SetValue( guidecoll(0)+".display.wirecol", 15, null);
MakeLocal(guidecoll(1)+".display", siDefaultPropagation);
SetValue( guidecoll(1)+".display.wirecol", 15, null);
//
// Position the guide objects
//
var lXfm = guidecoll(0).Kinematics.Global.Transform;
// slide control guides
lXfm.SetTranslationFromValues(-2,3,0);
guidecoll(0).Kinematics.Global.Transform = lXfm;
lXfm.SetTranslationFromValues(-1,-1,0);
guidecoll(1).Kinematics.Global.Transform = lXfm;
// hip bottom
lXfm.SetTranslationFromValues(-6,0,0);
guidecoll(2).Kinematics.Global.Transform = lXfm;
// thigh bone base and tip
var vThighBase = XSIMath.CreateVector3();
var vThighTip = XSIMath.CreateVector3();
vThighBase.Set(-3,3,0);
vThighTip.Set(-3.5,-4,0);
lXfm.SetTranslation(vThighBase);
guidecoll(3).Kinematics.Global.Transform = lXfm;
lXfm.SetTranslation(vThighTip);
guidecoll(4).Kinematics.Global.Transform = lXfm;
// Create a bone where the thigh bone is
var ThighChain = ActiveSceneRoot.Add2DChain(vThighBase, vThighTip);
var ThighSlide = MakeThighSlide("THIGH_", guidecoll, GetPrim("Null", "UpperParent"), ThighChain.Bones(0) );
logmessage ("Data in the returned thigh slide object:");
logmessage ("---------------------------------------");
logmessage ("Bind Null : " + ThighSlide.BindNull);
logmessage ("Top Null : " + ThighSlide.TopNull);
logmessage ("Base Null : " + ThighSlide.BaseNull);
logmessage ("Volume : " + ThighSlide.Volume);
//INFO : "Data in the returned thigh slide object:"
//INFO : "---------------------------------------"
//INFO : "Bind Null : THIGH_Bind"
//INFO : "Top Null : THIGH_Top"
//INFO : "Base Null : THIGH_Base"
//INFO : "Volume : THIGH_ThighVolume" |