23 Nov 2015, 6:04
(This post was last modified: 27 Nov 2015, 22:49 by Flávio San.)

I implemented some tricks in the "Tutorial #02: Color Cube" and I noticed something unexpected.

My body for void App::ColorCubeLogic::OnProcessTick(const Logic::IState* state) is now:

I noticed that my cube is spinning in the axis-Z unlike axis-X.

This only happens when the angleY is in (HALF_PI) or (PI + HALF_PI).

If this is true so, how I do to not carry in rotation the other axes together?

My body for void App::ColorCubeLogic::OnProcessTick(const Logic::IState* state) is now:

Code:

`void App::ColorCubeLogic::OnProcessTick(const Logic::IState* state)`

{

static Double angleX = 0;

static Double angleY = Math::HALF_PI;

static Double spinSpeed = 0.007;

angleX += spinSpeed;

angleX = Math::Fmod(angleX, Math::TWO_PI);

angleY = Math::Fmod(angleY, Math::TWO_PI);

mCubeTransform->SetRotation(angleX, angleY, 0);

state->SetUserDebugMessage(Util::DoubleToString(spinSpeed) + " -> " + Util::DoubleToString(angleX) + " / " + Util::DoubleToString(angleY) + "\n");

}

This only happens when the angleY is in (HALF_PI) or (PI + HALF_PI).

If this is true so, how I do to not carry in rotation the other axes together?

✠ nnDnn ✠ The peace of Christ! ✠ nnDnn ✠