Skip to main content

Scene Collision Query

Overview

The Scene Collision Query (Collision Detection) feature is used to detect the surface information of physics objects and object colliders in the physics scene.

Collision Detection Types

Detection MethodDescription
RaycastRaycast Collision Detection. Shoot a ray from the start position to the target position in the scene, and check whether there are other scene objects on this path.
Raycast
OverlapOverlap Collision Detection. Use a Collider (Sphere, Capsule, or Box) to detect whether there are other scene objects within the shape of the collider at a specified location in the scene.
Overlap-16842223236121
SweepSweep Collision Detection. Similar to Raycast Collision Detection, except that rays are replaced by Colliders (Sphere, Capsule, or Box). Move the collider from the start position to the target position in the scene, and detect whether the collider collides with other scene objects on its swept path.
Sweep

Collider Types

ColliderDescription
SphereSphere is described by a radius parameter. The origin of the sphere is at its center.
Sphere
BoxBox is described by three parameters: length, width, and height. The origin of the box is at its center.
Box
CapsuleCapsule is described by two sets of parameters: radius and half height. The direction of the capsule extends along the X-axis direction with its origin at its center.
Capsule

Collision Response Types

Collision ResponseDescription
BlockRaycast and Sweep Detections will return the closest collision result with the collision response as Block, and then terminate the Collision Detection.
Overlap Detection will return all the collision results with the collision response as Block.
OverlapRaycast and Sweep Detections will return all the collision results with the collision response as Overlap between the detection start point and the closest object whose collision response is Block.
Overlap Detection will return all the collision results with the collision response as Overlap.
IgnoreRaycast, Overlap, and Sweep Detections will ignore the collision results with the collision response as Ignore.

Collision Query Methods

Query MethodDescription
TestOnly returns information about whether a collision occurred, and does not return information of the object collided with.
SingleReturn the collision information of the Block object closest to the start point.
MultiRaycast and Sweep Detections will return the collision information of object that is closest to the start point with collision response as Block, and the collision information of the object in the path from the start point to the closest collided object with the collision response as Overlap.
Overlap Detection will return all objects with collision responses as Block and Overlap within the range of the collider.
Query MethodDescription
ByChannelQuery by Channel (Object Type) and collision response parameters.
Each component in the scene comes with a set of collision parameters (Channel + collision response parameters).
ByChannel uses the collision parameters passed in through the interface to make collision judgments with the components in the scene.
Components whose collision result is Block or Overlap (the query method must be Multi) will be returned.
For the description of the Channel and collision response parameters, as well as the description of the collision judgment rules, please refer to the section Collision in the documentation Common Physics Properties.
ByObjectTypeQuery by Object Type.
ByObjectType makes collision judgments with the components in the scene by inputting the Object Type to be queried.
Components matching the Object Type will be returned.
ByProfileQuery by Collision Preset Type.
The Collision Preset Configuration passed in by the ByProfile interface is used for collision judgments with the components in the scene.
Components whose collision result is Block or Overlap (the query method must be Multi) will be returned.
ByComponentQuery by Component.
ByComponent uses the component's own collider settings and collision parameter settings to make collision judgments with other components in the scene.
Components whose collision result is Block or Overlap (the query method must be Multi) will be returned.

Major Parameter Descriptions

Collision Channel Types (enum COLLISION_CHANNEL)

Related header file path: \source\fx_component\physics\physics_define.h

enum class COLLISION_CHANNEL : unsigned char
{
WorldStatic = CollisionChannel::eStatic,
WorldDynamic = CollisionChannel::eDynamic,
Pawn = CollisionChannel::ePawn,
Vehicle = CollisionChannel::eVehicle,
Destructible = CollisionChannel::eDestructible,
Visibility = CollisionChannel::eVisibility,
Camera = CollisionChannel::eCamera,
Trigger = CollisionChannel::eTrigger,
EngineTraceChannel1 = CollisionChannel::eEngineChannel8,
EngineTraceChannel2 = CollisionChannel::eEngineChannel9,
EngineTraceChannel3 = CollisionChannel::eEngineChannel10,
EngineTraceChannel4 = CollisionChannel::eEngineChannel11,
EngineTraceChannel5 = CollisionChannel::eEngineChannel12,
EngineTraceChannel6 = CollisionChannel::eEngineChannel13,

GameTraceChannel1,
GameTraceChannel2,
GameTraceChannel3,
GameTraceChannel4,
GameTraceChannel5,
GameTraceChannel6,
GameTraceChannel7,
GameTraceChannel8,
GameTraceChannel9,
GameTraceChannel10,
GameTraceChannel11,
GameTraceChannel12,
GameTraceChannel13,
GameTraceChannel14,
GameTraceChannel15,
GameTraceChannel16,
GameTraceChannel17,
GameTraceChannel18,

MAX,
}FX_ENUM();
Channel TypeDescription
WorldStaticRepresent the static object whose position in the scene does not change such as buildings and trees.
WorldDynamicRepresent the dynamic object whose position in the scene may change such as tables and chairs, cans and so on.
PawnRepresent the character controlled by the Player or AI.
VehicleRepresent the vehicle in the scene.
DestructibleRepresent the destructible object in the scene.
VisibilityMostly used for visibility collision detection.
CameraMostly used for camera objects in the scene, and camera collision detection.
TriggerMostly used for trigger objects in the scene, and collision detection triggered by trigger events.
EngineTraceChannel(1-6)Engine's reserved collision channel type.
GameTraceChannel(1-18)Collision channel types reserved for users' customization.
For the method of adding a custom collision channel in the Editor, please refer to the documentation Collision Preset Editor.

Note: There are 32 types of collision channels (objects) in total, 18 of which are provided for users to customize.

Querying Parameters by Object Types (struct collision_object_query_params_t)

InterfaceDescription
AddObjectTypesToQueryAdd the object (channel) type of this query.

Collision Response Parameters (struct collision_response_params_t)

Header file path: \source\fx_component\physics\physics_define.h

struct COMPONENT_API collision_response_params_t
{
collision_response_container_t CollisionResponse;
collision_response_params_t(COLLISION_RESPONSE DefaultResponse = COLLISION_RESPONSE::Block)
{
CollisionResponse.SetAllChannels(DefaultResponse);
}

collision_response_params_t(const collision_response_container_t& ResponseContainer)
{
CollisionResponse = ResponseContainer;
}

static collision_response_params_t DefaultResponseParam;
};
ParameterDescription
collision_response_container_t CollisionResponseCollision response parameter container which contains collision response settings for 32 collision channels.
For the description of the Channel and collision response parameters, as well as the description of the collision judgment rules, please refer to the section Collision in the documentation Common Physics Properties.

Collision Query Parameters (class CCollisionQueryParams)

ParameterDescription
bool bFindInitialOverlapsWhen the start position of the Raycast or Sweep Collision Detection is inside other scene objects, the collision detection will end and prompt the collision result that the start position is penetrated into other objects. If bFindInitialOverlaps is true, the collision detection will ignore the collision of the object at the start position and continue detecting.
bool bIgnoreBlocksIgnore all the results of the collision response as Block in this collision detection.
bool bIgnoreTouchesIgnore all the results of the collision response as Overlap in this collision detection.
QueryMobilityType::Enum eMobilityTypeOnly dynamic/static colliders are queried during collision detection.
QueryMobilityType::eStatic Only static colliders are queried in this collision detection.
QueryMobilityType::eDynamic Only dynamic colliders are queried in this collision detection.
QueryMobilityType::eAny Both dynamic and static colliders are queried in this collision detection.
bool bPickBothSidesEnable both sides detection. It only takes effect during the Raycast Collision Detection. If the ray penetrates the object when bPickBothSides is true, the collision information on the back of the object can be picked up.

Ignoring Collisions with Specified Objects

It will not be able to meet the logical requirement to ignore certain object collision detection only through collision detection and Collision Response parameter settings on each component. At this point, you can ignore the collision of some specific objects in collision detection by adding Ignore objects.

InterfaceDescription
AddIgnoredGameObjectIgnore collisions with the specified game object.
AddIgnoredComponentIgnore collisions with the specified component object.

Writing Custom Collision Filtering Logic

InterfaceDescription
SetLogicExtAdd a logic extension to filter all objects whose collision response is Block, and decide whether to retain the collision result with this object in this collision detection.

Refer to the implementation of class CollisionQueryFilter in \source\fx_component\fx_physics\collision_query_filter.h. Implement your own collision filtering logic by deriving a new type from CollisionQueryFilter. The implementation of the class CollisionQueryFilter is as follows:

#include "collision_query_filter.h"
#include "rigid_instance.h"
#include "ragdoll_instance.h"
#include "../primitive_component.h"
#include "../game_object.h"
#include "../physics/physx_user_data.h"
#include "flexi/physics/i_physics_rigid.h"
#include "flexi/utils/array_utils.h"
#include "flexi/object/casts.h"

CollisionQueryFilter::CollisionQueryFilter(const CCollisionQueryParams& QueryParams)
: m_IgnoreComponents(QueryParams.GetIgnoredComponents())
, m_IgnoreGameObjects(QueryParams.GetIgnoredGameObjects())
{

}

bool CollisionQueryFilter::OnKeepHit(const PERSISTID& phy_obj, unsigned int shape_key,
const wchar_t* debug_tag, const wchar_t* owner_tag)
{
FxPhysicsBase* pPhysicsObj = (FxPhysicsBase*)g_pCore->GetEntity(phy_obj);
if (NULL == pPhysicsObj)
{
return false;
}

LPrimitiveComponent* pOwnerComponent = NULL;

PhysicsProxy* pPhysicsProxy =
physx_user_data_t::Get<PhysicsProxy>(pPhysicsObj->GetUserData());

if (pPhysicsProxy != NULL)
{
pOwnerComponent = Cast<LPrimitiveComponent>(pPhysicsProxy->GetOwnerComponent());
}

if (NULL == pOwnerComponent)
{
return false;
}

LGameObject* pOwner = pOwnerComponent->GetGameObjectOwner();
if (NULL == pOwner)
{
Assert(0);
return false;
}

if (ArrayContains(m_IgnoreGameObjects, pOwner->GetID()))
{
return false;
}

if (ArrayContains(m_IgnoreComponents, pOwnerComponent->GetID()))
{
return false;
}

return true;
}

If the OnKeepHit function returns true, the collision result will be kept, otherwise the collision result will be ignored.

Collider Parameters (class CCollisionShape)

InterfaceDescription
SetCapsuleSet the appearance of the Capsule.
SetBoxSet the appearance of the Box.
SetSphereSet the appearance of the Sphere.

Collision Detection Result Parameters (struct hit_result_t)

ParameterDescription
PERSISTID GameObjectIDThe game object that collided with.
PERSISTID ComponentIDThe component object that collided with.
STRINGID BoneNameWhen the collision detects the ragdoll bone rigidbody, BoneName indicates the name of the ragdoll bone that collided with.
float fTimefTime = fDistance / length(f3QueryEnd - f3QueryStart)
bool bBlockingHitIf bBlockingHit is true, the collision response type of the current collision result will be Block. If it is false, the collision response type will be Overlap.
PERSISTID ActorIDThe rigidbody/destructible object that collided with.
int nShapeIndexWhen the ActorID is a rigidbody object, nShapeIndex represents the collider index of the rigidbody.
When the ActorID is a destructible object, nShapeIndex indicates the index of the destructible Chunk collided with, and -1 means an invalid destructible Chunk.
PERSISTID MateiralIDThe physics material object on the surface of the collider detected by the collision.
For details about physics materials, see the documentation Creating and Using Physics Materials.
FFLOAT3 f3QueryStartCollision detection start position.
FFLOAT3 f3QueryEndCollision detection end position.
bool bStartPenetratingWhether the start position penetrates into other objects.
float fPenetrationDepthPenetration depth.
FFLOAT3 f3LocationThe position of the collider when the collision occurred.
FFLOAT3 f3ImpactPointThe position of the collision point.
FFLOAT3 f3NormalWhen the collider type of Sweep Collision Detection is Sphere or Capsule, this value is a vector pointing to the origin of the collider from the collision point.
FFLOAT3 f3ImpactNormalThe surface normal on which the collision point lies.
float fDistanceThe distance at which the collision occurred.
unsigned int nFaceIndexCollision triangle index.

Interface Descriptions

Line Trace (Raycast) Detection

Querying by Object Types

LineTraceTestByObjectType
bool LineTraceTestByObjectType(CXMVECTOR vStart, CXMVECTOR vEnd,
const co11ision_object_query_params_t& ObjectQueryParams,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
const collision_object_query_params_t& ObjectQueryParamsQuery parameters by object type.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


LineTraceSingleByObjectType
bool LineTraceSingleByObjectType(hit_result_t& OutHit, CXMVECTOR vStart,
CXMVECTOR vEnd, const collision_object_query_params_t& ObjectQueryParams,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
hit_result_t& OutHitThe first type match result that is closest to the ray start point.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
const collision_object_query_params_t& ObjectQueryParamsQuery parameters by object type.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


LineTraceMultiByObjectType
bool LineTraceMultiByObjectType(TArray<hit_result_t, 1>& OutHits,
CXMVECTOR vStart, CXMVECTOR vEnd,
const collision_object_query_params_t& ObjectQueryParams,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
TArray<hit_result_t, 1>& OutHitsResults of all type matches on the ray path.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
const collision_object_query_params_t& ObjectQueryParamsQuery parameters by object type.
const CCollisionQueryParams& Params Collision query parameters.

Return value (bool): Whether there is a Block collision result.

Querying by Channels and Collision Response Parameters

LineTraceTestByChannel
bool LineTraceTestByChannel(CXMVECTOR Start, CXMVECTOR End,
COLLISION_CHANNEL TraceChannel,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const collision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
CXMVECTOR StartCollision detection start position.
CXMVECTOR EndCollision detection end position.
COLLISION_CHANNEL TraceChannelCollision channel type.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.


LineTraceSingleByChannel
bool LineTraceSingleByChannel(hit_result_t& OutHit, CXMVECTOR vStart,
CXMVECTOR vEnd, COLLISION_CHANNEL nTraceChannel,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const collision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
hit_result_t& OutHitThe Block collision result that is closest to the start point.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
COLLISION_CHANNEL nTraceChannelCollision channel type.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.


LineTraceMultiByChannel
bool LineTraceMultiByChannel(TArray<hit_result_t, 1>& OutHits,
CXMVECTOR vStart, CXMVECTOR vEnd, COLLISION_CHANNEL TraceChannel,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const collision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
TArray<hit_result_t, 1>& OutHitsThe Block collision result that is closest to the start point + All Overlap collision results between the start point and the closest Block collision result.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
COLLISION_CHANNEL TraceChannelCollision channel type.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.

Querying by Collision Presets

LineTraceTestByProfile
bool LineTraceTestByProfile(CXMVECTOR vStart, CXMVECTOR vEnd,
STRINGID ProfileName,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
STRINGID ProfileNameCollision Preset name.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


LineTraceSingleByProfile
bool LineTraceSingleByProfile(hit_result_t& OutHit, CXMVECTOR vStart, 
CXMVECTOR vEnd, STRINGID ProfileName,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
hit_result_t& OutHitThe Block collision result that is closest to the start point.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
STRINGID ProfileNameCollision preset name.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


LineTraceMultiByProfile
bool LineTraceMultiByProfile(TArray<hit_result_t, 1>& OutHits, 
CXMVECTOR vStart, CXMVECTOR vEnd, STRINGID ProfileName,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
TArray<hit_result_t, 1>& OutHitsThe Block collision result that is closest to the start point + All Overlap collision results between the start point and the closest Block collision result.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
STRINGID ProfileNameCollision preset name.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.

Overlap Test

Querying by Object Types

OverlapAnyTestByObjectType
bool OverlapAnyTestByObjectType(CXMVECTOR vPos, CXMVECTOR vQuatRot,
const collision_object_query_params_t& ObjectQueryParams,
const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
CXMVECTOR vPosCollision detection position.
CXMVECTOR vQuatRotCollider rotation.
const collision_object_query_params_t& ObjectQueryParamsQuery parameters by object type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


OverlapMultiByObjectType
bool OverlapMultiByObjectType(TArray<overlap_result_t, 1>& OutOverlaps,
CXMVECTOR vPos, CXMVECTOR vQuatRot,
const collision_object_query_params_t& ObjectQueryParams,
const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
TArray<overlap_result_t, 1>& OutOverlapsResults of all type matches within the collider range.
CXMVECTOR vPosCollision detection position.
CXMVECTOR vQuatRotCollider rotation.
const collision_object_query_params_t& ObjectQueryParamsQuery parameters by object type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.

Querying by Channels and Collision Response Parameters

OverlapAnyTestByChannel
bool OverlapAnyTestByChannel(CXMVECTOR vPos, CXMVECTOR vQuatRot,
COLLISION_CHANNEL nTraceChannel, const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const collision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
CXMVECTOR vPosCollision detection position.
CXMVECTOR vQuatRotCollider rotation.
COLLISION_CHANNEL nTraceChannelCollision channel type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.


OverlapBlockingTestByChannel
bool OverlapBlockingTestByChanne1(CXMVECTOR vPos, CXMVECTOR vQuatRot, 
COLLISION_CHANNEL nTraceChannel, const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const collision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
CXMVECTOR vPosCollision detection position.
CXMVECTOR vQuatRotCollider rotation.
COLLISION_CHANNEL nTraceChannelCollision channel type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.

What's different from OverlapAnyTestByChannel is that OverlapAnyTestByChannel detects collision response results that are Block or Overlap within the collider range, while OverlapBlockingTestByChannel only detects collision response results that are Block.


OverlapMultiByChannel
bool OverlapMultiByChannel(TArray<overlap_result_t, 1>& OutOverlaps, 
CXMVECTOR vPos, CXMVECTOR vQuatRot,
COLLISION_CHANNEL nTraceChannel, const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const collision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
TArray<overlap_result_t, 1>& OutOverlapsAll collision results that are Block and Overlap within the collider range.
CXMVECTOR vPosCollision detection position.
CXMVECTOR vQuatRotCollider rotation.
COLLISION_CHANNEL nTraceChannelCollision channel type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.

Querying by Collision Presets

OverlapMultiByProfile
bool OverlapMultiByProfile(TArray<overlap_result_t, 1>& OutOverlaps, 
CXMVECTOR vPos, CXMVECTOR vQuatRot, STRINGID ProfileName,
const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
TArray<overlap_result_t, 1>& OutOverlapsAll collision results that are Block and Overlap within the collider range.
CXMVECTOR vPosCollision detection position.
CXMVECTOR vQuatRotCollider rotation.
STRINGID ProfileNameCollision preset name.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.

Querying by Components

ComponentOverlapMulti
bool ComponentOverlapMulti(TArray<overlap_result_t, 1>& OutOverlaps, 
LPrimitiveComponent* pPrimComp, CXMVECTOR vPos, CXMVECTOR vQuatRot,
const CComponentQueryParams& Params);
ParameterDescription
TArray<overlap_result_t, 1>& OutOverlapsAll collision results that are Block and Overlap within the collider range.
LPrimitiveComponent* pPrimCompComponent object pointers.
CXMVECTOR vPosCollision detection position.
CXMVECTOR vQuatRotCollider rotation.
const CComponentQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.

Sweep Test

Querying by Object Types

SweepTestByObjectType
bool SweepTestByObjectType(CXMVECTOR vStart, CXMVECTOR vEnd, CXMVECTOR vQuatRot, 
const collision_object_query_params_t& ObjectQueryParams,
const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
const collision_object_query_params_t& ObjectQueryParamsQuery parameters by object type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


SweepSingleByObjectType
bool SweepSingleByObjectType(hit_result_t& OutHit, CXMVECTOR vStart,
CXMVECTOR vEnd, CXMVECTOR vQuatRot,
const collision_object_query_params_t& ObjectQueryParams,
const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
hit_result_t& OutHitThe Block collision result that is closest to the start point.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
const collision_object_query_params_t& ObjectQueryParamsQuery parameters by object type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


SweepMultiByObjectType
bool SweepMultiByObjectType(TArray<hit_result_t, 1>& OutHits,
CXMVECTOR vStart, CXMVECTOR vEnd, CXMVECTOR vQuatRot,
const collision_object_query_params_t& ObjectQueryParams,
const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
TArray<hit_result_t, 1>& OutHitsThe Block collision result that is closest to the start point + All Overlap collision results between the start point and the closest Block collision result.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
const collision_object_query_params_t& ObjectQueryParamsQuery parameters by object type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.

Querying by Channels and Collision Response Parameters

SweepTestByChannel
bool SweepTestByChannel(CXMVECTOR vStart, CXMVECTOR vEnd, CXMVECTOR vQuatRot,
COLLISION_CHANNEL TraceChannel, const CCollisionShape& CollsionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const collision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
COLLISION_CHANNEL TraceChannelCollision channel type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.


SweepSingleByChannel
bool SweepSingleByChannel(hit_result_t& OutHit, CXMVECTOR vStart,
CXMVECTOR vEnd, CXMVECTOR vQuatRot, COLLISION_CHANNEL nTraceChannel,
const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const CCollision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
hit_result_t& OutHitThe Block collision result that is closest to the start point.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
COLLISION_CHANNEL nTraceChannelCollision channel type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.


SweepMultiByChannel
bool SweepMultiByChannel(TArray<hit_result_t, 1>& OutHits,
CXMVECTOR vStart, CXMVECTOR vEnd, CXMVECTOR vQuatRot,
COLLISION_CHANNEL TraceChannel, const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams(),
const collision_response_params_t& ResponseParam = collision_response_params_t::DefaultResponseParam);
ParameterDescription
TArray<hit_result_t, 1>& OutHitsThe Block collision result that is closest to the start point + All Overlap collision results between the start point and the closest Block collision result.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
COLLISION_CHANNEL TraceChannelCollision channel type.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.
const collision_response_params_t& ResponseParamCollision response parameters.

Return value (bool): Whether there is a Block collision result.

Querying by Collision Presets

SweepTestByProfile
bool SweepTestByProfile(CXMVECTOR vStart, CXMVECTOR vEnd, CXMVECTOR vQuatRot,
STRINGID ProfileName, const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params);
ParameterDescription
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
STRINGID ProfileNameCollision preset name.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


SweepSingleByProfile
bool SweepSingleByProfile(hit_result_t& OutHit, CXMVECTOR vStart,
CXMVECTOR vEnd, CXMVECTOR vQuatRot, STRINGID ProfileName,
const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
hit_result_t& OutHitThe Block collision result that is closest to the start point.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
STRINGID ProfileNameCollision preset name.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.


SweepMultiByProfile
bool SweepMultiByProfile(TArray<hit_result_t, 1>& OutHits,
CXMVECTOR vStart, CXMVECTOR vEnd, CXMVECTOR vQuatRot,
STRINGID ProfileName, const CCollisionShape& CollisionShape,
const CCollisionQueryParams& Params = CCollisionQueryParams());
ParameterDescription
TArray<hit_result_t, 1>& OutHitsThe Block collision result that is closest to the start point + All Overlap collision results between the start point and the closest Block collision result.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
STRINGID ProfileNameCollision preset name.
const CCollisionShape& CollisionShapeCollider appearance.
const CCollisionQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.

Querying by Components

ComponentSweepMulti
bool ComponentSweepMulti(TArray<hit_result_t, 1>& OutHits,
LPrimitiveComponent* pPrimComp, CXMVECTOR vStart, CXMVECTOR vEnd,
CXMVECTOR vQuatRot, const CComponentQueryParams& Params);
ParameterDescription
TArray<hit_result_t, 1>& OutHitsThe Block collision result that is closest to the start point + All Overlap collision results between the start point and the closest Block collision result.
LPrimitiveComponent* pPrimCompComponent object pointers.
CXMVECTOR vStartCollision detection start position.
CXMVECTOR vEndCollision detection end position.
CXMVECTOR vQuatRotCollider rotation.
const CComponentQueryParams& ParamsCollision query parameters.

Return value (bool): Whether there is a Block collision result.

LPhyPickupComponent

Property Descriptions

PropertyDescription
Enable QueryCollision detection switch. If Enable Query is true, the component will perform collision detection for each frame of the scene.
Query TypeCollision query types.
  • Raycast
  • Overlap
Ignore BlockWhether to ignore all Block results.
Ignore OverlapWhether to ignore all Overlap results.

Raycast

image-20230519104431408

PropertyDescription
Main AxisSpecify the coordinate axis vector as the ray direction.
DistanceRay length.
Query MultiWhether to return multiple query results.
Pick Both SidesWhether to enable query on both sides.

Overlap Test

image-20230518175856917

PropertyDescription
Collider ComponentComponent object. When a component object is specified, collision detection will be performed using the specified component.
Geom TypeCollider types:
  • Box
  • Sphere
  • Capsule
Extent XThe length of the X-axis of the Box. Effective when Geom Type is Box.
Extent YThe length of the Y-axis of the Box. Effective when Geom Type is Box.
Extent ZThe length of the Z-axis of the Box. Effective when Geom Type is Box.
RadiusRadius of the Capsule or Sphere.
Effective when Geom Type is Sphere or Capsule.
Half HeightCapsule half height.
Effective when Geom Type is Capsule.