UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FreeRotationSubGizmo.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "InteractiveGizmo.h"
7#include "Math/MathFwd.h"
8
9#include "FreeRotationSubGizmo.generated.h"
10
22
26UCLASS(MinimalAPI)
28{
30
31public:
35 bool InitializeAsRotationGizmo(
39
40 // There are many potential approaches to doing a free rotate handle. Currently we
41 // implement IncrementalSphereBound from the below, which feels pretty intuitive,
42 // but we could add the other ones if desired.
43 //enum class EMode
44 //{
45 // // Intersect rays with a sphere and rotate the latest result such that the previous
46 // // intersection goes to the latest intersection. Outside of sphere, assume you are
47 // // on the tangent side of the sphere.
48 // // This is similar to how the normal editor gizmo works if you enable arcball rotation.
49 // IncrementalSphereBound,
50 //
51 // // Like IncrementalSphereBound, but rotate the original (not latest) transform such
52 // // that the first (i.e. original) intersection goes to latest intersection.
53 // // This is similar to how the ball works in the new gizmos (i.e. if Enable New Gizmos) is true.
54 // SourceToDestSphereBound,
55
56 // // Similar to SourceToDestSphereBound in that we're determining our rotation axis based on
57 // // the first intersection going to latest intersection, but the amount to rotate is determined
58 // // by the distance in the camera plane, so that we can keep rotating the object 360 degrees or
59 // // more with one drag.
60 // SourceToDestUnbounded
61 //};
62 //void SetMode(EMode::ModeIn);
63
67 void SetUnscaledSphereRadius(double Radius) { UnscaledSphereRadius = Radius; }
68
73 void SetShowSphereBoundsDuringInteraction(bool bOn) { bShowSphereBoundsDuringInteraction = bOn; }
74
75 // UInteractiveGizmo overrides
76 virtual void Setup() override;
77 virtual void Render(IToolsContextRenderAPI* RenderAPI) override;
78 virtual void Tick(float DeltaTime) override;
79
80 // IClickDragBehaviorTarget implementation
81 virtual FInputRayHit CanBeginClickDragSequence(const FInputDeviceRay& PressPos) override;
82 virtual void OnClickPress(const FInputDeviceRay& PressPos) override;
83 virtual void OnClickDrag(const FInputDeviceRay& DragPos) override;
84 virtual void OnClickRelease(const FInputDeviceRay& ReleasePos) override;
85 virtual void OnTerminateDragSequence() override;
86
87 // IHoverBehaviorTarget implementation
88 virtual FInputRayHit BeginHoverSequenceHitTest(const FInputDeviceRay& PressPos) override;
89 virtual void OnBeginHover(const FInputDeviceRay& DevicePos) override;
90 virtual bool OnUpdateHover(const FInputDeviceRay& DevicePos) override;
91 virtual void OnEndHover() override;
92
93public:
94 // The below properties can be manipulated for more fine-grained control, but typically it is sufficient
95 // to use the initialization method above.
96
98 UPROPERTY()
100
102 UPROPERTY()
104
106 UPROPERTY()
108
110 UPROPERTY()
112
114 UPROPERTY()
115 TObjectPtr<UGizmoViewContext> GizmoViewContext = nullptr;
116
118 UPROPERTY()
120
121private:
122 bool bInInteraction = false;
123 bool bShowSphereBoundsDuringInteraction = true;
124
125 FVector LastSphereIntersectionPoint;
126 double InteractionSphereRadius = 0;
127 bool ClickPress_IncrementalSphereBound(const FInputDeviceRay& PressPos);
128 bool ClickDrag_IncrementalSphereBound(const FInputDeviceRay& DragPos);
129
130 double UnscaledSphereRadius = 100;
131
132 // Helper that can hold some extra upkeep to do during Tick (used to
133 // update a camera axis source if needed).
134 TUniqueFunction<void(float DeltaTime)> CustomTickFunction;
135};
136
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UCLASS(...)
Definition ObjectMacros.h:776
Definition BehaviorTargetInterfaces.h:91
Definition GizmoInterfaces.h:64
Definition GizmoInterfaces.h:108
Definition GizmoInterfaces.h:272
Definition GizmoInterfaces.h:37
Definition BehaviorTargetInterfaces.h:230
Definition ToolContextInterfaces.h:427
Definition ScriptInterface.h:139
Definition FunctionFwd.h:19
Definition ClickDragBehavior.h:33
Definition FreeRotationSubGizmo.h:28
void SetShowSphereBoundsDuringInteraction(bool bOn)
Definition FreeRotationSubGizmo.h:73
void SetUnscaledSphereRadius(double Radius)
Definition FreeRotationSubGizmo.h:67
Definition GizmoViewContext.h:20
Definition InteractiveGizmo.h:29
Definition FreeRotationSubGizmo.h:18
@ false
Definition radaudio_common.h:23
Definition InputState.h:367
Definition InputState.h:52
Definition ObjectPtr.h:488
Definition TransformSubGizmoUtil.h:37
Definition TransformSubGizmoUtil.h:99