Mail Archives: djgpp/1999/02/23/08:10:44
Lee writes:
> i've made a small modification to TransformObj(). when the object is
> rotated, it seems as if the axis is located at screen coordinates 0, 0.
>
> how do i select my own axis to rotate the object?
Do you mean an axis aligned somewhere other than along the x/y/z
primaries, or located somewhere other than through the origin?
If you want a rotation other than around x/y/z, use
get_vector_rotation_matrix(). If you want to rotate about a point
other than the origin, shift so that your pivot point will become
the origin (ie. translate by -pivot), rotate, and then translate
back to the original location. This is where matrix concatenation
becomes really handy, because you can build up a single matrix
that contains all three of these transforms, and then apply it
to your vertices as just a single operation.
Shawn Hargreaves.
- Raw text -