fedorov.ilya Posted June 15, 2018 Share Posted June 15, 2018 (edited) Hello everyone, I`m having a bit of a problem setting up a proper orthographic camera with C++ API in my projects. It seems that there is no way for me to change a camera projection without creating my own mat4 and passing it as an argument to setProjection to the class camera. Is there any other way around to acomplish this task without going in depth with matrix conversations? Edited June 15, 2018 by fedorov.ilya Link to comment
fox Posted June 15, 2018 Share Posted June 15, 2018 Hello Ilya, You can set up orthographic projection for your camera via the Camera::setProjection() or Player::setProjection() methods. For example, you can set up perspective projection for your current camera like this: #include <UniginePlayers.h> #include <UnigineGame.h> using namespace Unigine; /* ... */ int AppWorldLogic::init() { /* ... */ // getting our current player PlayerPtr player = Game::get()->getPlayer(); // setting up near and far clipping planes float znear = 0.001f; float zfar = 10000.0f; // setting up orthographic projection player->setProjection(Math::ortho(-1.0f, 1.0f, -1.0f, 1.0f, znear, zfar)); return 1; } Hope this helps! Thanks! 1 Link to comment
fedorov.ilya Posted June 15, 2018 Author Share Posted June 15, 2018 Thanks you so much, this problem solved now. Link to comment
Recommended Posts