dongju.jeong Posted June 1, 2020 Share Posted June 1, 2020 (edited) PhysicsIntersectionPtr intersection = PhysicsIntersection::create(); // get an intersection Vec3 p1 = node->getWorldPosition(); ter->setForceIntersection(1); ObjectPtr object = Physics::get()->getIntersection(lastPos, p1, 0x00000001,intersection); ter->setForceIntersection(0); NodePtr contactNode; if (object) { ... } lastPos = p1; Sometimes contact with the terrain fails. Is it because I didn't use worldIntersecion instead? Or is it due to the terrain material optimization option (Back Face Culling, Subpixel Polygons Reduce)? Edited June 1, 2020 by dongju.jeong Link to comment
morbid Posted June 1, 2020 Share Posted June 1, 2020 Hello, Hard to tell why. Do you see any patterns when intersection fails? You also can try the following: Disable setForceIntersection and check how it influences the result Call this code from updatePhysics Use PhysicsIntersectionNormalPtr intersection = PhysicsIntersectionNormal::create(); instead PhysicsIntersectionPtr intersection = PhysicsIntersection::create(); Thanks. 1 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
dongju.jeong Posted June 2, 2020 Author Share Posted June 2, 2020 (edited) well.. I experimented by implementing the code in the fired bullet. It's different every time I run it, but if I find a failing location and fire a bullet at the same location, it always fails. after try the method you gave me, I tell you again. Thank you. Edited June 2, 2020 by dongju.jeong Link to comment
Recommended Posts