Object space rotation

Started by Jonas, November 14, 2007, 07:29:13 PM

Previous topic - Next topic

Jonas

Hi

Having trouble with what i think is pretty basic ;D. I most probably just dont understand how rotation works.. :).

Im trying to draw some axis arrows..so I made my own arrow object3d and added it to a scene(see picture..the negativ y one is the original).
Now Id like to rotate that arrow to align it with the other axis. When i do the following:

o3ds[0] = createArrow();
       
       o3ds[1] = createArrow();
       o3ds[1].rotateZ((float)Math.toRadians(-90));
       
       o3ds[2] = createArrow();
       o3ds[2].rotateX((float)Math.toRadians(90));
       


it looks like this:


Now..is there a way to rotate these arrow so I dont have to translate them back in position(sphere is 0,0,0)? I tried setting the pivot and center of the arrow inside the sphere(which is the origin of the axis arrow too) but it doesent seem to work either.
Simple things should be simple, complex things should be possible - Alan Kay

EgonOlsen

Pivot should do the job, but be sure to set it after calling build() because build() resets the pivot. Maybe that causes the problem!?

Jonas

Hi

Thanks, that helped pin down the error. I actually built the object and reset the pivot, but had another buildAllObjects() in the scene load code, which reset the pivot again ;D.

Works now.
Simple things should be simple, complex things should be possible - Alan Kay