chi
03-23-2009, 10:39 PM
ok so...i'm definately not a whiz with the xpresso/math/anything that requires a bit of logical thought...but I feel i should be able to follow a tutorial...right now what i'm trying to recreate is this.
vector $A = unit (<<(L_WristLoc.translateX - L_ShoulderLoc.translateX),
(L_WristLoc.translateY - L_ShoulderLoc.translateY),
(L_WristLoc.translateZ - L_ShoulderLoc.translateZ)>>);
vector $B = <<(L_Shoulder_ProjectLoc.translateX - L_ElbowLoc.translateX),
(L_Shoulder_ProjectLoc.translateY - L_ElbowLoc.translateY),
(L_Shoulder_ProjectLoc.translateZ - L_ElbowLoc.translateZ)>>;
vector $C = <<(L_Elbow_ProjectLoc.translateX - L_ElbowLoc.translateX),
(L_Elbow_ProjectLoc.translateY - L_ElbowLoc.translateY),
(L_Elbow_ProjectLoc.translateZ - L_ElbowLoc.translateZ)>>;
float $dotProd = dot($A, $B);
float $length = mag($A);
float $scale = $dotProd / ($length * $length);
L_Shoulder_ResultLoc.translateX = L_ElbowLoc.translateX + ($A.x * $scale);
L_Shoulder_ResultLoc.translateY = L_ElbowLoc.translateY + ($A.y * $scale);
L_Shoulder_ResultLoc.translateZ = L_ElbowLoc.translateZ + ($A.z * $scale);
float $dotProd = dot($A, $C);
float $length = mag($A);
float $scale = $dotProd / ($length * $length);
L_Elbow_ResultLoc.translateX = L_ElbowLoc.translateX + ($A.x * $scale);
L_Elbow_ResultLoc.translateY = L_ElbowLoc.translateY + ($A.y * $scale);
L_Elbow_ResultLoc.translateZ = L_ElbowLoc.translateZ + ($A.z * $scale);
so far i seem to have things going good...but i have reached to issues...the dotprod is coming out as a real number and not a vector...so like 654,654,654 and i can not find any way of calculating the mag (vectors magnitude) value. can anyone with a mathy brain help me?
vector $A = unit (<<(L_WristLoc.translateX - L_ShoulderLoc.translateX),
(L_WristLoc.translateY - L_ShoulderLoc.translateY),
(L_WristLoc.translateZ - L_ShoulderLoc.translateZ)>>);
vector $B = <<(L_Shoulder_ProjectLoc.translateX - L_ElbowLoc.translateX),
(L_Shoulder_ProjectLoc.translateY - L_ElbowLoc.translateY),
(L_Shoulder_ProjectLoc.translateZ - L_ElbowLoc.translateZ)>>;
vector $C = <<(L_Elbow_ProjectLoc.translateX - L_ElbowLoc.translateX),
(L_Elbow_ProjectLoc.translateY - L_ElbowLoc.translateY),
(L_Elbow_ProjectLoc.translateZ - L_ElbowLoc.translateZ)>>;
float $dotProd = dot($A, $B);
float $length = mag($A);
float $scale = $dotProd / ($length * $length);
L_Shoulder_ResultLoc.translateX = L_ElbowLoc.translateX + ($A.x * $scale);
L_Shoulder_ResultLoc.translateY = L_ElbowLoc.translateY + ($A.y * $scale);
L_Shoulder_ResultLoc.translateZ = L_ElbowLoc.translateZ + ($A.z * $scale);
float $dotProd = dot($A, $C);
float $length = mag($A);
float $scale = $dotProd / ($length * $length);
L_Elbow_ResultLoc.translateX = L_ElbowLoc.translateX + ($A.x * $scale);
L_Elbow_ResultLoc.translateY = L_ElbowLoc.translateY + ($A.y * $scale);
L_Elbow_ResultLoc.translateZ = L_ElbowLoc.translateZ + ($A.z * $scale);
so far i seem to have things going good...but i have reached to issues...the dotprod is coming out as a real number and not a vector...so like 654,654,654 and i can not find any way of calculating the mag (vectors magnitude) value. can anyone with a mathy brain help me?
