MakeThighSlide

Introduced

v4.0

Description

Creates a two-point slide setup (a bind null two-point constrained to two control objects, see Make2PointSlide) and a spherical thigh volume object that bounding volume constrains the bind null. The collection of guide objects passed to MakeThighSlide determines the position of the slide, and the proportions of the thigh volume.

The guide collection contains 5 objects. The first two objects are to position the top and bottom control objects of the slide. The bind point will be the midpoint between these two objects, and also determines the center of the thigh volume. The third object is the bottom of the hip, and will determine the radius of the thigh volume. The fourth and fifth objects are the base and tip of the thigh bone (leg and knee joints). The vector created by these two points defines the thigh bone and is used to align the thigh volume with the thigh bone.

Scripting Syntax

oThighSlide = MakeThighSlide( [Prefix], GuideObjectCollection, UpperParent, LowerParent );

Return Value

Returns a ThighSlide JScript object.

Parameters

Parameter Type Description
Prefix String The name prefix for the newly created slide nulls.
GuideObjectCollection String A list of items to search for when making the thigh slide. It must have a minimum of 5 items where:

Possible Values:

Description:

Item 0 Guide object for top of Slide
Item 1 Guide object for bottom of Slide
Item 2 Guide object for bottom of Slide at side of the hip
Item 3 Guide object down center of thigh at start of leg
Item 4 Guide object down center of thigh at knee
UpperParent String The parent object for the upper part of the thigh slide assembly, typically the hip.
LowerParent String The parent object for the lower part of the thigh slide assembly, typically the thigh bone.

Examples

JScript Example

/*

	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"

See Also

Make2PointSlide