PDA

View Full Version : Position and Rotation | Local space

 JokerMartini06-21-2011, 11:10 PMIm trying to place the teapot which is at a [0,0,50] world position, to a plane’s local [0,0,50] space.Which the positioning part of it works. The rotation is wrong though. Its opposite. In this example the teapot goes to the correct position, but the rotation is opposite of what it should be. ( undo on ( clearListener() newMatrix = \$Teapot01.transform * \$Plane01.transform -- Calculate offset between objects \$Teapot01.position = newMatrix.position in coordsys (transmatrix \$Teapot01.transform.pos) \$Teapot01.rotation = quatToEuler newMatrix.rotation ) ) this is the sloppy solution ( undo on ( clearListener() newMatrix = \$Teapot01.transform * \$Plane01.transform -- Calculate offset between objects \$Teapot01.position = newMatrix.position newRotation = quatToEuler newMatrix.rotation newRotation.x *= -1; newRotation.y *= -1; newRotation.z *= -1; in coordsys \$Teapot01.transform \$Teapot01.rotation = newRotation ) ) attached is the test scene.
eek
06-22-2011, 04:38 AM
tm = \$plane01.transform

\$teapot.transform = matrix3 tm.row1 tm.row2 tm.row3 (transMatrix [0,0,50] * tm).row4

Ruramuq
06-22-2011, 08:28 AM
similar:

\$Teapot001.transform = (transMatrix [0,0,100]) * \$Plane001.transform

denisT
06-22-2011, 04:34 PM
the same as:

\$Teapot01.transform = preTranslate \$Plane01.transform [0,0,50]

CGTalk Moderation
06-22-2011, 04:34 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.