keywords: [UE4]Overlap检测的常用工具函数

keyword: Overlap、Test、Blocking

World.h

/**
*  Test the collision of a shape at the supplied location using a specific channel, and return if any blocking overlap is found
*  @param  Pos             Location of center of box to test against the world
*  @param  TraceChannel    The 'channel' that this query is in, used to determine which components to hit
*  @param  CollisionShape    CollisionShape - supports Box, Sphere, Capsule, Convex
*  @param  Params          Additional parameters used for the trace
*  @param  ResponseParam    ResponseContainer to be used for this trace
*  @return TRUE if any blocking results are found
*/
bool OverlapBlockingTestByChannel(const FVector& Pos, const FQuat& Rot, ECollisionChannel TraceChannel, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam, const FCollisionResponseParams& ResponseParam = FCollisionResponseParams::DefaultResponseParam) const;

/**
*  Test the collision of a shape at the supplied location using a specific channel, and return if any blocking or overlapping shape is found
*  @param  Pos             Location of center of box to test against the world
*  @param  TraceChannel    The 'channel' that this query is in, used to determine which components to hit
*  @param  CollisionShape    CollisionShape - supports Box, Sphere, Capsule, Convex
*  @param  Params          Additional parameters used for the trace
*  @param  ResponseParam    ResponseContainer to be used for this trace
*  @return TRUE if any blocking or overlapping results are found
*/
bool OverlapAnyTestByChannel(const FVector& Pos, const FQuat& Rot, ECollisionChannel TraceChannel, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam, const FCollisionResponseParams& ResponseParam = FCollisionResponseParams::DefaultResponseParam) const;

/**
*  Test the collision of a shape at the supplied location using object types, and return if any overlap is found
*  @param  Pos             Location of center of box to test against the world
*  @param  ObjectQueryParams    List of object types it's looking for
*  @param  CollisionShape    CollisionShape - supports Box, Sphere, Capsule, Convex
*  @param  Params          Additional parameters used for the trace
*  @return TRUE if any blocking results are found
*/
bool OverlapAnyTestByObjectType(const FVector& Pos, const FQuat& Rot, const FCollisionObjectQueryParams& ObjectQueryParams, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam) const;

/**
*  Test the collision of a shape at the supplied location using a specific profile, and return if any blocking overlap is found
*  @param  Pos             Location of center of box to test against the world
*  @param  ProfileName     The 'profile' used to determine which components to hit
*  @param    CollisionShape    CollisionShape - supports Box, Sphere, Capsule
*  @param  Params          Additional parameters used for the trace
*  @return TRUE if any blocking results are found
*/
bool OverlapBlockingTestByProfile(const FVector& Pos, const FQuat& Rot, FName ProfileName, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam) const;

/**
*  Test the collision of a shape at the supplied location using a specific profile, and return if any blocking or overlap is found
*  @param  Pos             Location of center of box to test against the world
*  @param  ProfileName     The 'profile' used to determine which components to hit
*  @param    CollisionShape    CollisionShape - supports Box, Sphere, Capsule
*  @param  Params          Additional parameters used for the trace
*  @return TRUE if any blocking or overlapping results are found
*/
bool OverlapAnyTestByProfile(const FVector& Pos, const FQuat& Rot, FName ProfileName, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam) const;


/**
 *  Test the collision of a shape at the supplied location using a specific channel, and determine the set of components that it overlaps
 *  @param  OutOverlaps     Array of components found to overlap supplied box
 *  @param  Pos             Location of center of shape to test against the world
 *  @param  TraceChannel    The 'channel' that this query is in, used to determine which components to hit
 *  @param    CollisionShape    CollisionShape - supports Box, Sphere, Capsule
 *  @param  Params          Additional parameters used for the trace
 *     @param     ResponseParam    ResponseContainer to be used for this trace
 *  @return TRUE if OutOverlaps contains any blocking results
 */
bool OverlapMultiByChannel(TArray<struct FOverlapResult>& OutOverlaps, const FVector& Pos, const FQuat& Rot, ECollisionChannel TraceChannel, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam, const FCollisionResponseParams& ResponseParam = FCollisionResponseParams::DefaultResponseParam) const;


/**
 *  Test the collision of a shape at the supplied location using object types, and determine the set of components that it overlaps
 *  @param  OutOverlaps     Array of components found to overlap supplied box
 *  @param  Pos             Location of center of shape to test against the world
 *    @param    ObjectQueryParams    List of object types it's looking for
 *  @param    CollisionShape    CollisionShape - supports Box, Sphere, Capsule
 *  @param  Params          Additional parameters used for the trace
 *  @return TRUE if any overlap is found
 */
bool OverlapMultiByObjectType(TArray<struct FOverlapResult>& OutOverlaps, const FVector& Pos, const FQuat& Rot, const FCollisionObjectQueryParams& ObjectQueryParams, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam) const;

/**
 *  Test the collision of a shape at the supplied location using a specific profile, and determine the set of components that it overlaps
 *  @param  OutOverlaps     Array of components found to overlap supplied box
 *  @param  Pos             Location of center of shape to test against the world
 *  @param  ProfileName     The 'profile' used to determine which components to hit
 *  @param    CollisionShape    CollisionShape - supports Box, Sphere, Capsule
 *  @param  Params          Additional parameters used for the trace
 *  @return TRUE if OutOverlaps contains any blocking results
 */
bool OverlapMultiByProfile(TArray<struct FOverlapResult>& OutOverlaps, const FVector& Pos, const FQuat& Rot, FName ProfileName, const FCollisionShape& CollisionShape, const FCollisionQueryParams& Params = FCollisionQueryParams::DefaultQueryParam) const;

今年花胜去年红。可惜明年花更好,知与谁同?—欧阳修《浪淘沙》