[Closed] help MaxScript for rig system
hey guys, i have a small problem with a script that i am trying to do
the idea is to make a script that can create a rig for any characters (standard rig for people ) with a few clicks … so the problem is when i try to align a bone to a dummy it aligns the position but not the rotation.
you will find below a screenshot of the result i am getting
by the way this is my first time in maxscript and here is the code :
maxops.affectchildren=false
select $Dummy001
aa = $.rotation.x
bb = $.rotation.y
cc = $.rotation.z
a = $.pos.x
b = $.pos.y
c = $.pos.z
select $Bone001
$.rotation.x = aa
$.rotation.y = bb
$.rotation.z = cc
$.pos.x = a
$.pos.y = b
$.pos.z = c
select $Dummy002
aa = $.rotation.x
bb = $.rotation.y
cc = $.rotation.z
a = $.pos.x
b = $.pos.y
c = $.pos.z
select $Bone002
$.rotation.x = aa
$.rotation.y = bb
$.rotation.z = cc
$.pos.x = a
$.pos.y = b
$.pos.z = c
select $Dummy003
aa = $.rotation.x
bb = $.rotation.y
cc = $.rotation.z
a = $.pos.x
b = $.pos.y
c = $.pos.z
select $Bone003
$.rotation.x = aa
$.rotation.y = bb
$.rotation.z = cc
$.pos.x = a
$.pos.y = b
$.pos.z = c
Hey man!
the way I would go about doing this is to create the bones rather than trying to position the bones.
So here is how the code would look like for creating the chain of bones that you need given that you have dummys as guides.
bone1 = boneSys.createBone $Dummy001.pos $Dummy002.pos [0,0,1]
bone2 = boneSys.createBone $Dummy002.pos $Dummy003.pos [0,0,1]
bone2.parent = bone1
bone3 = boneSys.createBone $Dummy003.pos $Dummy003.pos [0,0,1]
bone3.parent = bone2
-- the nub(end) bone wont be aligned with the previous bone so we have to align their rotations.
in coordsys (transMatrix bone3.pos) bone3.rotation = bone2.rotation
-- and here we fix the lenght of the nub(end) bone.
bone3.length = ((bone3.width + bone3.height) / 2)
This is just a quick way of getting you started. It is not the most optimal/best way but it gets the job done.