ataylor Posted May 6, 2016 Share Posted May 6, 2016 I have situations where I want to compute world intersection infinitely above a body on Z axis.C++ code: Unigine::WorldIntersectionPtr intersection=Unigine::WorldIntersection::create(); Unigine::Math::dvec3 src=myBodyRigid->getPosition(); Unigine::Math::dvec3 dst=src; dst.z+=100000; //dst.z=INFINITY; Does not work! Unigine::ObjectPtr intersectedObject=Unigine::World::get()->getIntersection(src, dst, 0xFF, intersection); if(intersectedObject.get()){ Unigine::Log::message("found object!\n"); } else{ Unigine::Log::message("no found object :(\n"); } This code will find the object above myBodyRigid if dst.z is set to body's z+100000. But I do not like having that arbitrary magic number there, would prefer to look infinitely upwards. However, setting dst.z to INFINITY results in no object found.Is there a way to do "infinite" world intersection check instead of simply using large numbers? Link to comment
ulf.schroeter Posted May 9, 2016 Share Posted May 9, 2016 No, you have to use large numbers. Performance-wise distance limiting also makes perfect sense in nearly all use-cases. Link to comment
Recommended Posts