Jump to content

Ortho camera's world rotate result is different.


photo

Recommended Posts

Posted

 

Hello. I have a simple question.

Ortho camera's  worldrotate result is different.

It is a difference of 0.1 degrees, and as a result there is a difference of 90 degrees. I wondered if there was something I misunderstood.

Simple Source

int AppWorldLogic::init()
{
    // Write here code to be called on editor initialization.
    PlayerPtr player = Game::get()->getPlayer();

    float znear = 0.1f;
    float zfar    = 100.0f;
    float aspect= 16.0f / 9.0f;
    int ortho    = 1;

    vec3 dir    = vec3(0.0f, 0.0f, -1.0f);
    vec3 up        = vec3(0.0f, 1.0f, 0.0f);
    int    axis    = AXIS_NZ;

    player->setPosition(Vec3(0.0f, 0.0f, 1.0f));
    player->setDirection(dir, up, axis);

    //check please... degree diff is 0.1, but rotate result is 90 degree diffrent.
    //player->worldRotate(Unigine::Math::quat(0.0f, 0.0f, 0.0f)); //apply fail...
    player->worldRotate(Unigine::Math::quat(0.1f, 0.0f, 0.0f)); //apply ok...

    player->setProjection(Math::ortho(-1.0f, 1.0f, -1.0f, 1.0f, znear, zfar));

    return 1;
}

 

Thank You.

 

 

0.png

0.1.png

Posted

Hi park.sungsoo,

PlayerPtr player = Game::get()->getPlayer();
What type of player used? PlayerSpectator? It doesn't have roll and it cannot look upside down.
Try to use PlayerDummy:

PlayerSpectator player = PlayerSpectator::create();
Game::get()->setPlayer(player->getPlayer());

// apply it if you have SDK v2.8 and older
player->release();
Editor::get()->addNode(player->getNode());

Best regards,
Alexander

Posted

Thank you for your kind reply.

I will apply what you said.

×
×
  • Create New...