|
![](/i/fill.gif) |
Weinzierl Stefan wrote:
> Hi,
>
> I know, its a little bit off-topic but I've a little problem with
> rotation.
>
> The problem is for a game I need a rolling ball, so I made the matrix in
> the first picture with the code below. As you can see in the blue
> rectangles this runs good, when I rotate only one axis. But when both
> axis must be rotated I don't get the result what I wan't. The second
> picture show's how the green marked rectangle should look like. Or in an
> other question how could I rotate both axis in the same time?
> object {
> Ball
> //rotate -rx*30*y
> //rotate -ry*30*x
> rotate <-ry*30, -rx*30, 0>
>
Rotation occurs in a set order, first around the x axis, then around the y,
and finally around the z axis, so your commented rotation statements are
different than the last one that is uncommented. To rotate around these axes
in a different order you must do it manually, as you have in the commented out
version.
It is posible to do it with matrix multiplication, so take a look at
http://enphilistor.users4.50megs.com/matrix.htm and use the matrix for
rotation around y and the matrix for rotation around x.
I beleive that you have to multiply rot(x) by rot(y) in that order, since
matrix multiplication is not commutative (which basically means the order is
important, swapping the order will give different results). You will also have
to take heed to John's warning and add the fourth column to both matrices
before you can multiply them.
The result of all of this is that from the coding point of view the easiest
way to acheive the rotation you want is to declare two rotation commands, and
the rest is academically interesting, but not necessary.
--
Josh English -- Lexiphanic Lethomaniac
eng### [at] spiritone com
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/
Post a reply to this message
|
![](/i/fill.gif) |