dark99 Posted February 9, 2024 Posted February 9, 2024 World::getIntersection with dynamically created mesh dose not work test code is here -------------------------------- auto mesh = ObjectMeshDynamic::create(); mesh->allocateVertex(4); mesh->allocateIndices(6); mesh->addVertex(vec3(0, 0, 1)); mesh->addVertex(vec3(1, 0, 1)); mesh->addVertex(vec3(1, 1, 1)); mesh->addVertex(vec3(0, 1, 1)); mesh->addIndex(0); mesh->addIndex(1); mesh->addIndex(2); mesh->addIndex(0); mesh->addIndex(2); mesh->addIndex(3); mesh->addSurface("mat0"); mesh->setIntersection(true, 0); mesh->setIntersectionMask(1, 0); mesh->updateTangents(); mesh->updateBounds(); auto obj = World::getIntersection(vec3(0.5, 0.5, 2), vec3(0.5, 0.5, 0), 1); if (obj) { Log::message("hit\n"); }
silent Posted February 9, 2024 Posted February 9, 2024 dark99 Could you please specify SDK version that you are currently using? Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
cash-metall Posted February 12, 2024 Posted February 12, 2024 Hello! have you tried to call World::updateSpatial after node creation? As a new node becomes a part of the BSP tree only after the updateSpatial()method is called (the engine calls the method automatically each frame after the world script update()code is executed), all engine subsystems can process this node only in the next frame.
dark99 Posted February 15, 2024 Author Posted February 15, 2024 It works after call World::updateSpatial() Thanks !
Recommended Posts