dark99 Posted February 9 Share Posted February 9 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"); } Link to comment
silent Posted February 9 Share Posted February 9 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 Link to comment
cash-metall Posted February 12 Share Posted February 12 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. Link to comment
dark99 Posted February 15 Author Share Posted February 15 It works after call World::updateSpatial() Thanks ! Link to comment
Recommended Posts