SimApi Physics GetClosestHitPoint

From SIMboxWiki
Jump to navigation Jump to search

Icon attributes.pngstatic bool SimApi::Physics::GetClosestHitPoint(LinearVec &i_RayOrigin, LinearVec &i_RayDirection, LinearVec &o_HitPoint, float i_RayLength=500.0f)


    Finds the closest hit point from a defined position, in a defined direction


    i_RayOrigin - The ray origin position
    i_RayDirection - The ray direction
    o_HitPoint - The output hit point
    i_RayLength - The maximal ray length (not in use)


    Type: bool   Description: true if an object was hit. false if no object was hit.


    Code Sample

LinearVec rayOrigin(0,0,1000.0f);
LinearVec rayDirection(0,0,-1.0);
LinearVec hitPoint;