Free shipping on orders over \$75

# Center point of rotation XYZ shift.

 Print view Share : #at3win #at3winheader h3 { text-align:left !important; } Previous topicNext topic

Page 1 of 1 [ 4 posts ]

Guru ( offline )
Posts: 3301
Posted: 2010-08-15 19:34
 Post subject: Center point of rotation XYZ shift.
Using AtomPro28, BB2, SSC32, with PS2. and running Xans Phoenix code v2.0.

when doing body rotations, tilts and rolls, with the left J/Stick, how can i change the Rotation point using the right stick?

what i mean is 'while doing these movements' instead of just rotating from the center of the body XYZ id like to move the center point of rotation around on the fly using the right J/Stick.

_________________
Jonny Poole,
Freelance Concept Art & Animatronics, 3D Art and 3D Modelling, as well as Physical Modelling, Mechanical design, and illustration.
http://www.innerbreed.co.uk
Create, Innovate, Inspire.

Guru ( offline )
Posts: 2131
Posted: 2010-08-16 02:53
 Post subject: Re: Center point of rotation XYZ shift.
Hi Jonny,

Take a look at the BodyIK sub:
Code:
BodyIKLeg var nib
BodyIK [PosX, PosZ, PosY, RotationY, BodyIKLeg]

;Calculating totals from center of the body to the feet
CPR_X = cOffsetX(BodyIKLeg)+PosX
CPR_Y = PosY + BodyRotOffsetY ; Define centerpoint for rotation along the Y-axis
CPR_Z = cOffsetZ(BodyIKLeg) + PosZ + BodyRotOffsetZ

;Successive global rotation matrix:
;Math shorts for rotation: Alfa (A) = Xrotate, Beta (B) = Zrotate, Gamma (G) = Yrotate
;Sinus Alfa = sinA, cosinus Alfa = cosA. and so on...

;First calculate sinus and cosinus for each rotation:
GOSUB GetSinCos [BodyRotX1+TotalXBal1]
SinG4 = Sin4
CosG4 = Cos4

GOSUB GetSinCos [BodyRotZ1+TotalZBal1]
SinB4 = Sin4
CosB4 = Cos4

GOSUB GetSinCos [BodyRotY1+(RotationY*c1DEC)+TotalYBal1]
SinA4 = Sin4
CosA4 = Cos4

;Calcualtion of rotation matrix:

BodyIKPosX = (CPR_X*c2DEC - ( CPR_X*c2DEC*CosA4/c4DEC*CosB4/c4DEC - CPR_Z*c2DEC*CosB4/c4DEC*SinA4/c4DEC + CPR_Y*c2DEC*SinB4/c4DEC ))/c2DEC
BodyIKPosZ = (CPR_Z*c2DEC - ( CPR_X*c2DEC*CosG4/c4DEC*SinA4/c4DEC + CPR_X*c2DEC*CosA4/c4DEC*SinB4/c4DEC*SinG4/c4DEC + CPR_Z*c2DEC*CosA4/c4DEC*CosG4/c4DEC - CPR_Z*c2DEC*SinA4/c4DEC*SinB4/c4DEC*SinG4/c4DEC - CPR_Y*c2DEC*CosB4/c4DEC*SinG4/c4DEC ))/c2DEC
BodyIKPosY = (CPR_Y  *c2DEC - ( CPR_X*c2DEC*SinA4/c4DEC*SinG4/c4DEC - CPR_X*c2DEC*CosA4/c4DEC*CosG4/c4DEC*SinB4/c4DEC + CPR_Z*c2DEC*CosA4/c4DEC*SinG4/c4DEC + CPR_Z*c2DEC*CosG4/c4DEC*SinA4/c4DEC*SinB4/c4DEC + CPR_Y*c2DEC*CosB4/c4DEC*CosG4/c4DEC ))/c2DEC

return

For shifting/changing the CPR you only need to set the variable BodyRotOffsetZ, BodyRotOffsetY. If you need to set the X you'll need to add that variable. It might be a bit hard to change all 3 coordinates at the same time with only one 2DOF joystick though.

_________________
Kåre Halvorsen, Zenta
-----------------------------------------
Zenta's blog
http://zentasrobots.com/
-----------------------------------------

Guru ( offline )
Posts: 3301
Posted: 2010-08-16 11:11
 Post subject: Re: Center point of rotation XYZ shift.
just the person i was looking for. yes silly me why didn't i see that. self explanatory really.
makes perfect sense.
thanks bud.

_________________
Jonny Poole,
Freelance Concept Art & Animatronics, 3D Art and 3D Modelling, as well as Physical Modelling, Mechanical design, and illustration.
http://www.innerbreed.co.uk
Create, Innovate, Inspire.

Guru ( offline )
Posts: 2131
Posted: 2010-08-16 12:20
 Post subject: Re: Center point of rotation XYZ shift.
Your welcome Jonny, good luck with your programming work!

_________________
Kåre Halvorsen, Zenta
-----------------------------------------
Zenta's blog
http://zentasrobots.com/