Coppel.Damien Posted July 27, 2020 Share Posted July 27, 2020 Hello, The function "getWorldBoundBox" always returns Vec3(0,0,0) in 2.12. The following code works in 2.10.2 but always returns 0,0,0 after upgrading my project to 2.12-beta2 PlayerDummyPtr player = PlayerDummy::create(); Game::setPlayer(player); float znear = 0.1f; float zfar = 10000.0f; player->setFov(60.0f); player->setZNear(znear); player->setZFar(zfar); player->setWorldPosition(Vec3(0, -3., 1)); player->worldLookAt(Vec3(0., 0., 0.)); NodePtr testNode = World::loadNode("/home/ganoufa/unigine_projects/tmptest/data/models/mymodel.fbx"); testNode->setEnabled(true); testNode->setWorldPosition(Vec3(0., 0., 0.)); WorldBoundBox bbox3D = testNode->getWorldBoundBox(); Vec3 bmin = bbox3D.getMin(); Vec3 bmax = bbox3D.getMax(); std::cout << "bmin = " << bmin.x << ", " << bmin.y << ", " << bmin.z << '\n'; std::cout << "bmax = " << bmax.x << ", " << bmax.y << ", " << bmax.z << '\n'; Link to comment
silent Posted July 27, 2020 Share Posted July 27, 2020 Hi Damien, Bounding box calculations changed in 2.11 release: https://developer.unigine.com/en/docs/2.11/upgrade/migration_api?rlang=cpp#bounds_changes Now getWorldBoundBox will return bounds for the selected object without it's children (in case of NodeDummy it will return all zeroes). More likely in your case you need to call getHierarchyBoundBox to get the resulting bounding box. Similar issue: https://developer.unigine.com/forum/topic/6179-solved-cannot-access-boundbox-of-created-nodes-in-custom-consolecommand/ Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Coppel.Damien Posted July 28, 2020 Author Share Posted July 28, 2020 Thanks, It works with getHierarchyWorldBoundBox instead of getWorldBoundBox. Link to comment
Recommended Posts