Notifications
Clear all

[Closed] Position and Rotation | Local space

Im 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.

3 Replies
 eek

tm = $plane01.transform

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

similar:

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

the same as:


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