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. :question:

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_Xc2DEC - ( CPR_Xc2DECCosA4/c4DECCosB4/c4DEC - CPR_Zc2DECCosB4/c4DECSinA4/c4DEC + CPR_Yc2DECSinB4/c4DEC ))/c2DEC
BodyIKPosZ = (CPR_Z
c2DEC - ( CPR_Xc2DECCosG4/c4DECSinA4/c4DEC + CPR_Xc2DECCosA4/c4DECSinB4/c4DECSinG4/c4DEC + CPR_Zc2DECCosA4/c4DECCosG4/c4DEC - CPR_Zc2DECSinA4/c4DECSinB4/c4DECSinG4/c4DEC - CPR_Yc2DECCosB4/c4DECSinG4/c4DEC ))/c2DEC
BodyIKPosY = (CPR_Y c2DEC - ( CPR_Xc2DEC
SinA4/c4DECSinG4/c4DEC - CPR_Xc2DECCosA4/c4DECCosG4/c4DECSinB4/c4DEC + CPR_Zc2DECCosA4/c4DECSinG4/c4DEC + CPR_Zc2DECCosG4/c4DECSinA4/c4DECSinB4/c4DEC + CPR_Yc2DECCosB4/c4DEC*CosG4/c4DEC ))/c2DEC

return [/code]

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.

just the person i was looking for. yes silly me why didn’t i see that. self explanatory really. :blush:
makes perfect sense.
thanks bud.

Your welcome Jonny, good luck with your programming work!