Cesium for Unreal 2.13.2
Loading...
Searching...
No Matches
CesiumOriginShiftComponent.h
Go to the documentation of this file.
1// Copyright 2020-2024 CesiumGS, Inc. and Contributors
2
3#pragma once
4
6#include "CoreMinimal.h"
7#include "CesiumOriginShiftComponent.generated.h"
8
10
11/**
12 * Indicates how to shift the origin as the Actor to which a
13 * CesiumOriginShiftComponent is attached moves.
14 */
15UENUM(BlueprintType)
16enum class ECesiumOriginShiftMode : uint8 {
17 /**
18 * This component is disabled and will have no effect.
19 */
21
22 /**
23 * The origin of the CesiumGeoreference will be changed when the Actor enters
24 * a new sub-level, but it will otherwise not be modified as the Actor moves.
25 * Any objects that are not anchored to the globe with a
26 * CesiumGlobeAnchorComponent will appear to move when the Actor enters a
27 * sub-level.
28 */
30
31 /**
32 * The origin of the CesiumGeoreference will change as the Actor moves in
33 * order to maintain small, precise coordinate values near the Actor, as well
34 * as to keep the globe's local "up" direction aligned with the +Z axis. Any
35 * objects that are not anchored to the globe with a
36 * CesiumGlobeAnchorComponent will appear to move whenever the origin changes.
37 *
38 * When using this mode, all Cesium3DTileset instances as well as any Actors
39 * with a CesiumGlobeAnchorComponent need to be marked Movable, because these
40 * objects _will_ be moved when the origin is shifted.
41 */
43};
44
45/**
46 * Automatically shifts the origin of the Unreal world coordinate system as the
47 * object to which this component is attached moves. This improves rendering
48 * precision by keeping coordinate values small, and can also help world
49 * building by keeping the globe's local up direction aligned with the +Z axis.
50 *
51 * This component is typically attached to a camera or Pawn. By default, it only
52 * shifts the origin when entering a new sub-level (a Level Instance Actor with
53 * a CesiumSubLevelComponent attached to it). By changing the Mode and Distance
54 * properties, it can also shift the origin continually when in between
55 * sub-levels (or when not using sub-levels at all).
56 *
57 * It is essential to add a CesiumGlobeAnchorComponent to all other non-globe
58 * aware objects in the level; otherwise, they will appear to move when the
59 * origin is shifted. It is not necessary to anchor objects that are in
60 * sub-levels, because the origin remains constant for the entire time that a
61 * sub-level is active.
62 */
63UCLASS(ClassGroup = "Cesium", Meta = (BlueprintSpawnableComponent))
64class CESIUMRUNTIME_API UCesiumOriginShiftComponent
66 GENERATED_BODY()
67
68#pragma region Properties
69private:
70 /**
71 * Indicates how to shift the origin as the Actor to which this component is
72 * attached moves.
73 */
74 UPROPERTY(
75 EditAnywhere,
76 BlueprintReadWrite,
77 BlueprintGetter = GetMode,
78 BlueprintSetter = SetMode,
79 Category = "Cesium",
80 Meta = (AllowPrivateAccess))
82
83 /**
84 * The maximum distance between the origin of the Unreal coordinate system and
85 * the Actor to which this component is attached. When this distance is
86 * exceeded, the origin is shifted to bring it close to the Actor. This
87 * property is ignored if the Mode property is set to "Disabled" or "Switch
88 * Sub Levels Only".
89 *
90 * When the value of this property is 0.0, the origin is shifted continuously.
91 */
92 UPROPERTY(
93 EditAnywhere,
94 BlueprintReadWrite,
95 BlueprintGetter = GetDistance,
96 BlueprintSetter = SetDistance,
97 Category = "Cesium",
98 Meta = (AllowPrivateAccess))
99 double Distance = 0.0;
100#pragma endregion
101
102#pragma region Property Accessors
103public:
104 /**
105 * Gets a value indicating how to shift the origin as the Actor to which this
106 * component is attached moves.
107 */
108 UFUNCTION(BlueprintGetter)
109 ECesiumOriginShiftMode GetMode() const;
110
111 /**
112 * Sets a value indicating how to shift the origin as the Actor to which this
113 * component is attached moves.
114 */
115 UFUNCTION(BlueprintSetter)
116 void SetMode(ECesiumOriginShiftMode NewMode);
117
118 /**
119 * Gets the maximum distance between the origin of the Unreal coordinate
120 * system and the Actor to which this component is attached. When this
121 * distance is exceeded, the origin is shifted to bring it close to the Actor.
122 * This property is ignored if the Mode property is set to "Disabled" or
123 * "Switch Sub Levels Only".
124 *
125 * When the value of this property is 0.0, the origin is shifted continuously.
126 */
127 UFUNCTION(BlueprintGetter)
128 double GetDistance() const;
129
130 /**
131 * Sets the maximum distance between the origin of the Unreal coordinate
132 * system and the Actor to which this component is attached. When this
133 * distance is exceeded, the origin is shifted to bring it close to the Actor.
134 * This property is ignored if the Mode property is set to "Disabled" or
135 * "Switch Sub Levels Only".
136 *
137 * When the value of this property is 0.0, the origin is shifted continuously.
138 */
139 UFUNCTION(BlueprintSetter)
140 void SetDistance(double NewDistance);
141#pragma endregion
142
143public:
145
146protected:
147 virtual void TickComponent(
148 float DeltaTime,
149 ELevelTick TickType,
150 FActorComponentTickFunction* ThisTickFunction) override;
151};
ECesiumOriginShiftMode
Indicates how to shift the origin as the Actor to which a CesiumOriginShiftComponent is attached move...
@ SwitchSubLevelsOnly
The origin of the CesiumGeoreference will be changed when the Actor enters a new sub-level,...
@ ChangeCesiumGeoreference
The origin of the CesiumGeoreference will change as the Actor moves in order to maintain small,...
@ Disabled
This component is disabled and will have no effect.
This component can be added to a movable actor to anchor it to the globe and maintain precise placeme...
Automatically shifts the origin of the Unreal world coordinate system as the object to which this com...
virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override