--- Torque Character Node Script v1.0
--- 7-8-07 Thomas Shaw
--- Notes: I am not a MAXscript god. If anyone wants to 
--- improve this, please do. There are probably more efficient ways to do this.
--- Issues: The "eye" node needs to be pulled out of the head a little.
--- The user needs to create a "bounds" box manually. It is usually parented
--- to the BIP01 node or the BIP01 pelvis and should encompass everything
--- that needs to be exported.
--- The "cam" node probably will go flying off somewhere. It needs to be behind and slightly above the character. Just select it in the schematic window to find it.

--- eye node
select $'bip01 head'	
newobj = snapshot $		--- makes a "copy" of the selected biped part. We need an object to center our torque node to and biped bones don't work for that.
newobj.name = "head"	--- names our fake head part "head"
select $'head'			--- selects the "head"
max unlink				--- unlinks the fake head part from the biped hierarchy
centerpivot($'head')	--- centers the fake head's pivot to itself - otherwise when we align our Torque node to it, the node would align to the bottom of the head.
myEye = Dummy pos:[0,0,0] isSelected:on --- creates torque dummy
myEye.name = "eye" 						--- names torque dummy
myEye.pos = newobj.pos					--- matches the position of our dummy to the copied biped part.
$.parent = $'Bip01 Head'				--- parents our dummy to the "real" biped part.
delete newobj							--- deletes the fake biped part.

--- Unlink node
myUnlink = Dummy pos:[0,0,0] isSelected:on
myUnlink.name = "unlink"
$.parent = $Bip01

--- Cam node
myCam = Dummy pos:[0,0,0] isSelected:on
myCam.name = "cam"
move $ [0,-261.727,0]	--- you can change this to suit your needs, these are the values that worked for my setup
move $ [0,0,605.516]	--- you can change this to suit your needs, these are the values that worked for my setup
$.parent = $'unlink'

--- Detail2 node
myDetail2 = Dummy pos:[0,0,0] isSelected:on
myDetail2.name = "detail2"
$.parent = $Bip01

--- mount0 node
select $'Bip01 R Hand'
newobj = snapshot $
newobj.name = "Rhand"
select $'Rhand'
max unlink
centerpivot($'Rhand')
myMount0 = Dummy pos:[0,0,0] isSelected:on
myMount0.name = "mount0"
myMount0.pos = newobj.pos
$.parent = $'Bip01 R Hand'
delete newobj

---Moun1 node
select $'Bip01 L Hand'
newobj = snapshot $
newobj.name = "Lhand"
select $'Lhand'
max unlink
centerpivot($'Lhand')
myMount1 = Dummy pos:[0,0,0] isSelected:on
myMount1.name = "mount1"
myMount1.pos = newobj.pos
$.parent = $'Bip01 L Hand'
delete newobj


---Ski0 node
select $'Bip01 R calf'
newobj = snapshot $
newobj.name = "RCalf"
select $'RCalf'
max unlink
centerpivot($'RCalf')
mySki0 = Dummy pos:[0,0,0] isSelected:on
mySki0.name = "ski0"
mySki0.pos = newobj.pos
$.parent = $'Bip01 R Calf'
delete newobj

---Ski1 node
select $'Bip01 L calf'
newobj = snapshot $
newobj.name = "LCalf"
select $'LCalf'
max unlink
centerpivot($'LCalf')
mySki1 = Dummy pos:[0,0,0] isSelected:on
mySki1.name = "ski1"
mySki1.pos = newobj.pos
$.parent = $'Bip01 L Calf'
delete newobj
