Hi there,

I'm experimenting with camera movements lately, and  basically I'm
trying to apply to my camera several rotations at a time, around x and
y axes using trig formulas.My aim is to make the camera rotate around
a sphere (very basic). My result is quite good except for some things.
First when applying some "extreme" values (such as 180° or 360°) I get
a weird result, with the camera flipping brutally. Then, I have a
matter with the camera.z, actually I don't know which value to apply
it so the camera sticks to its rotation axis (or at least so I can get
some best control over the camera.z).

I know I could use the HoverCamera but I don"t want to, as I want to
understand the mechanisms of movement, and I want to apply my own
tweenings and easing to my camera.

I also tryied to adapt the HoverCamera formulas, but I might have not
got something in it as the result is not really convincing.

For now my code is the following (based on matrix calculation):

_rx.rotationMatrix (1, 0, 0, degreesToRadians (angleX + .001));
_ry.rotationMatrix (0, 1, 0, degreesToRadians (angleY + .001));
_rotation.multiply (_rx, _ry);
_num.matrix2euler (_rotation);

_cam.x = _num.x * -_radius;
_cam.y = _num.y * -_radius;

the camera is a TargetCamera targeting a ObjectContainer3D placed in
(0,0,0)
_radius is the distance I want the camera to stay while rotating
_rx, _ry and _rotation are my matrix

what am I missing/doing wrong?

cheers

Reply via email to