UDragAlignmentMechanic

Mechanic that can be added to (potentially multiple) [UCombinedTransformGizmo](API\Runtime\InteractiveToolsFramework\BaseGizmos\UCombinedTransformGizmo) object to allow them to snap to scene geometry in rotation and translation when the Ctrl key is pressed.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

ModelingComponents

Header

/Engine/Plugins/Runtime/MeshModelingToolset/Source/ModelingComponents/Public/Mechanics/DragAlignmentMechanic.h

Include

#include "Mechanics/DragAlignmentMechanic.h"

Syntax

UCLASS()
class UDragAlignmentMechanic :
    public UInteractionMechanic,
    public IModifierToggleBehaviorTarget

Remarks

Mechanic that can be added to (potentially multiple) UCombinedTransformGizmo object to allow them to snap to scene geometry in rotation and translation when the Ctrl key is pressed.

Variables

Name Description

Protected variable

int32

 

AlignmentModifierID

Protected variable

bool

 

bAlignmentToggle

Protected variable

bool

 

bPreviewEndpointsValid

We keep track of the last position we gave the user and the last position that they moved their gizmo.

Protected variable

bool

 

bWaitingOnProjectedResult

Protected variable

FViewCameraStat...

 

CachedCameraState

Used for snapping to verts.

Protected variable

FHitResult

 

LastHitResult

Protected variable

FVector3d

 

LastProjectedResult

Protected variable

TUniqueFunction...

 

MeshRayCast

Protected variable

TUniqueFunction...

 

MeshRayCastTriangleFilter

Protected variable

float

 

VisualAngleSnapThreshold

Protected variable

TUniqueFunction...

 

WorldRayCast

These are modifiable in case we someday want to make it easier to customize them further.

Functions

Name Description

Public function

void

 

AddToGizmo

(
    UCombinedTransformGizmo* Trans...,
    const TArray< const UPrimitiveCompo...,
    const TArray< const UPrimitiveCompo...
)

Adds this mechanic to the given gizmo.

Public function

void

 

AddToGizmo

(
    UIntervalGizmo* IntervalGizmo,
    const TArray< const UPrimitiveCompo...,
    const TArray< const UPrimitiveCompo...
)

Like the other AddToGizmo, but acts on interval gizmos.

Protected function Virtual

bool

 

CastRay

(
    const FRay& WorldRay,
    FVector& OutputPoint,
    const TArray< const UPrimitiveCompo...,
    const TArray< const UPrimitiveCompo...,
    bool bUseFilter
)

Casts a ray into the scene to find an alignment point. Used in the functions bound to gizmos.

Public function

void

 

InitializeDeformedMeshRayCast

(
    TFunction< UE::Geometry::FDynamicMe...,
    const UE::Geometry::FTransform3d& ...,
    const FGroupTopologyDeformer* ...
)

Optional- allows the use of the mechanic in mesh deformation.

Protected function

void

 

OnGizmoTransformChanged

(
    FTransform NewTransform
)

Overridden from UInteractionMechanic

Name Description

Public function Virtual

void

 

Render

(
    IToolsContextRenderAPI* Render...
)

This will draw a line from the last input position to the last output position.

Public function Virtual

void

 

Setup

(
    UInteractiveTool* ParentTool
)

Called to initialize the InteractionMechanic

Public function Virtual

void

 

Shutdown()

Called to clean up the InteractionMechanic

Overridden from IModifierToggleBehaviorTarget

Name Description

Public function Virtual

void

 

OnUpdateModifierState

(
    int ModifierID,
    bool bIsOn
)

IModifierToggleBehaviorTarget implementation.

Constants

Name

Description

EDGE_HIT_TYPE_ID

TRIANGLE_HIT_TYPE_ID

Used to identify the type of object we hit, so we can choose different renderings.

VERT_HIT_TYPE_ID