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)

    Description

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

    Parameters

    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)

    Return

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

    Remarks
    



    Code Sample
    

LinearVec rayOrigin(0,0,1000.0f);
LinearVec rayDirection(0,0,-1.0);
LinearVec hitPoint;
SimApi::Physics::GetClosestHitPoint(rayOrigin,rayDirection,hitPoint);


    

GetClosestHitPointSpecificObjectType
GetClosestHitPointIgnoreSpecificObjectType