XM Magdalena 3D print, GGeorgy (3D)
LC #42 Pipers Alley

View Full Version : hand-coded aim constraint

10-05-2006, 02:01 PM
does anyone know how to mel-code an aim constraint with an up-vector? i want to give it two vectors (aim/up) and get three rotation values back.
what i got so far is:

$locPos = <<locator1.translateX, locator1.translateY, locator1.translateZ>>;
pCube1.rotateZ = atan($locPos.y / $locPos.x) / 2 / 3.14159265 * 360;
if($locPos.x < 0)
pCube1.rotateZ = pCube1.rotateZ -180 ;

pCube1.rotateY = atan(-$locPos.z / sqrt($locPos.x*$locPos.x+$locPos.y*$locPos.y)) / 2 / 3.14159265 * 360;

it constrains the rotation of the pCube to the vector the locator/worldCenter describes. but i wasn't able to figure out how it works with the up-vector.

any ideas?

CGTalk Moderation
10-05-2006, 02:01 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.