SimApi Physics GetClosestHitPointIgnoreSpecificObjectType

From SIMboxWiki
Jump to navigation Jump to search

Icon attributes.pngstatic bool SimApi::Physics::GetClosestHitPointIgnoreSpecificObjectType(LinearVec &i_RayOrigin, LinearVec &i_RayDirection, string &i_ObjectType, LinearVec &o_HitPoint, int &o_EntityID, float i_RayLength=500.0f)


    Finds the closest hit point from a defined position, in a defined direction, ignoring a defined simulation object type


    i_RayOrigin - The ray origin position
    i_RayDirection - The ray direction
    i_ObjectType - The simulation object type to find the hit point on
    o_HitPoint - The output hit point
    o_EntityID - The output hit entity ID
    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;
int entityId;
// ignoring Oil Rig entities
SimApi::Physics::GetClosestHitPointIgnoreSpecificObjectType(rayOrigin,rayDirection,string("Oil Rig"),hitPoint,entityId);

    See Also