Transform - Victor-Haefner/polyvr GitHub Wiki
Virtual objects in 3D Space have a transformation, position and orientation, in space. Most scenegraph objects inherit from 'Transform'.
Different ways to define the transformation:
-
OpenGL Matrix
setMatrix( [a,d,g,x, b,e,h,y, c,f,j,z, u,v,w,n] )
-
From, dir, up
setFrom( [x,y,z] )- set the position
setDir( [x,y,z] )- set the direction
setUp( [x,y,z] )- set the up direction
- From, at, up
setAt( [x,y,z] )- set the point in space where the object looks at
Using setDir()/setAt() switches the internal state of the transform to dir/at. This changes the behaviour of the transform when changing the position. When in dir mode, the orientation does not change when changing the position. When in at mode, the orientation changes to allways look at the at point in space.