![]() |
Cesium for Unreal 2.13.2
|
A component intended to be attached to a Level Instance Actor that turns that Level Instance into a Cesium sub-level. More...
#include <CesiumSubLevelComponent.h>
Public Member Functions | |
bool | GetEnabled () const |
Gets whether this sub-level is enabled. | |
void | SetEnabled (bool value) |
Sets whether this sub-level is enabled. | |
double | GetOriginLongitude () const |
Gets the longitude of the georeference origin for this sub-level in degrees, in the range [-180, 180]. | |
void | SetOriginLongitude (double value) |
Sets the longitude of the georeference origin for this sub-level in degrees, in the range [-180, 180]. | |
double | GetOriginLatitude () const |
Gets the latitude of the georeference origin for this sub-level in degrees, in the range [-90, 90]. | |
void | SetOriginLatitude (double value) |
Sets the latitude of the georeference origin for this sub-level in degrees, in the range [-90, 90]. | |
double | GetOriginHeight () const |
Gets the height of the georeference origin for this sub-level in meters above the ellipsoid. | |
void | SetOriginHeight (double value) |
Sets the height of the georeference origin for this sub-level in meters above the ellipsoid. | |
double | GetLoadRadius () const |
Gets how close to the sub-level local origin, in meters, the camera needs to be to load the level. | |
void | SetLoadRadius (double value) |
Sets how close to the sub-level local origin, in meters, the camera needs to be to load the level. | |
TSoftObjectPtr< ACesiumGeoreference > | GetGeoreference () const |
Gets the designated georeference actor controlling how the actor's coordinate system relates to the coordinate system in this Unreal Engine level. | |
void | SetGeoreference (TSoftObjectPtr< ACesiumGeoreference > NewGeoreference) |
Sets the designated georeference actor controlling how the actor's coordinate system relates to the coordinate system in this Unreal Engine level. | |
ACesiumGeoreference * | GetResolvedGeoreference () const |
Gets the resolved georeference, just like calling the ResolveGeoreference property, except that it will return null if a georeference has not yet been resolved. | |
ACesiumGeoreference * | ResolveGeoreference (bool bForceReresolve=false) |
Resolves the Cesium Georeference to use with this components. | |
void | SetOriginLongitudeLatitudeHeight (const FVector &longitudeLatitudeHeight) |
Sets the longitude (X), latitude (Y), and height (Z) of this sub-level's georeference origin. | |
void | UpdateGeoreferenceIfSubLevelIsActive () |
If this sub-level is currently the active one, this method will copy its origin to the georeference's origin. | |
virtual void | BeginDestroy () override |
virtual void | OnComponentCreated () override |
Protected Member Functions | |
virtual void | BeginPlay () override |
virtual void | OnRegister () override |
Called when a component is registered. | |
virtual void | OnUnregister () override |
Called when a component is unregistered. | |
A component intended to be attached to a Level Instance Actor that turns that Level Instance into a Cesium sub-level.
Only a single Cesium sub-level can be active (visible) at any given time.
A globe (like the planet Earth) is an unusual sort of level in Unreal in that it has truly massive coordinate values and the "up" direction depends on where exactly on the globe you're located. Many things in the Unreal ecosystem, such as the gravity system, don't expect this situation and will have incorrect and surprising behavior when used on a globe.
Cesium sub-levels help to mitigate this. Only one sub-level can be active at any given time, and when it is, that sub-level's origin becomes the origin of the Unreal world. Furthermore, at the origin location, Unreal's +X axis points East, its +Y axis points South, and its +Z axis points Up. Thus, within a sub-level, gravity works in the normal way that Unreal objects expect, and coordinate values stay relatively small. This allows you to use just about any Unreal object within a sub-level without worrying about surprising behavior.
Globe-aware objects, particularly those with a "Cesium Globe Anchor" component attached to them, are allowed to exist outside sub-levels and even move between them. If all your objects are globe aware, there's no need to use sub-levels at all.
In the Editor, the currently-active sub-level is selected by clicking the "Eye" icon next to the Level Instance in the Outliner.
At runtime, the currently-active sub-level is selected by the Actor with a CesiumOriginShiftComponent attached to it. If this Actor is inside a sub-level's "Load Radius" that sub-level will be activated. If multiple sub-levels are in range, only the closest one will be activated.
Definition at line 47 of file CesiumSubLevelComponent.h.
|
overridevirtual |
|
overrideprotectedvirtual |
bool UCesiumSubLevelComponent::GetEnabled | ( | ) | const |
Gets whether this sub-level is enabled.
An enabled sub-level will be automatically loaded when the camera moves within its LoadRadius and no other levels are closer, and the Georeference will be updated so that this level's Longitude, Latitude, and Height become (0, 0, 0) in the Unreal World. A sub-level that is not enabled will be ignored by Cesium at runtime.
TSoftObjectPtr< ACesiumGeoreference > UCesiumSubLevelComponent::GetGeoreference | ( | ) | const |
Gets the designated georeference actor controlling how the actor's coordinate system relates to the coordinate system in this Unreal Engine level.
If this is null, the sub-level will find and use the first Georeference Actor in the level, or create one if necessary. To get the active/effective Georeference from Blueprints or C++, use ResolvedGeoreference instead.
double UCesiumSubLevelComponent::GetLoadRadius | ( | ) | const |
Gets how close to the sub-level local origin, in meters, the camera needs to be to load the level.
double UCesiumSubLevelComponent::GetOriginHeight | ( | ) | const |
Gets the height of the georeference origin for this sub-level in meters above the ellipsoid.
This height should not be confused with a height above Mean Sea Level. When this sub-level is active, the CesiumGeoreference will adopt this origin.
double UCesiumSubLevelComponent::GetOriginLatitude | ( | ) | const |
Gets the latitude of the georeference origin for this sub-level in degrees, in the range [-90, 90].
When this sub-level is active, the CesiumGeoreference will adopt this origin.
double UCesiumSubLevelComponent::GetOriginLongitude | ( | ) | const |
Gets the longitude of the georeference origin for this sub-level in degrees, in the range [-180, 180].
When this sub-level is active, the CesiumGeoreference will adopt this origin.
ACesiumGeoreference * UCesiumSubLevelComponent::GetResolvedGeoreference | ( | ) | const |
Gets the resolved georeference, just like calling the ResolveGeoreference property, except that it will return null if a georeference has not yet been resolved.
|
overridevirtual |
|
overrideprotectedvirtual |
Called when a component is registered.
This can be viewed as "enabling" this Component on the Actor to which it is attached.
In the Editor, this is called in a many different situations, such as on changes to properties.
|
overrideprotectedvirtual |
Called when a component is unregistered.
This can be viewed as "disabling" this Component on the Actor to which it is attached.
In the Editor, this is called in a many different situations, such as on changes to properties.
ACesiumGeoreference * UCesiumSubLevelComponent::ResolveGeoreference | ( | bool | bForceReresolve = false | ) |
Resolves the Cesium Georeference to use with this components.
Returns the value of the Georeference property if it is set. Otherwise, finds a Georeference in the World and returns it, creating it if necessary. The resolved Georeference is cached so subsequent calls to this function will return the same instance, unless ForceReresolve is true.
void UCesiumSubLevelComponent::SetEnabled | ( | bool | value | ) |
Sets whether this sub-level is enabled.
An enabled sub-level will be automatically loaded when the camera moves within its LoadRadius and no other levels are closer, and the Georeference will be updated so that this level's Longitude, Latitude, and Height become (0, 0, 0) in the Unreal World. A sub-level that is not enabled will be ignored by Cesium at runtime.
void UCesiumSubLevelComponent::SetGeoreference | ( | TSoftObjectPtr< ACesiumGeoreference > | NewGeoreference | ) |
Sets the designated georeference actor controlling how the actor's coordinate system relates to the coordinate system in this Unreal Engine level.
If this is null, the sub-level will find and use the first Georeference Actor in the level, or create one if necessary. To get the active/effective Georeference from Blueprints or C++, use ResolvedGeoreference instead.
void UCesiumSubLevelComponent::SetLoadRadius | ( | double | value | ) |
Sets how close to the sub-level local origin, in meters, the camera needs to be to load the level.
void UCesiumSubLevelComponent::SetOriginHeight | ( | double | value | ) |
Sets the height of the georeference origin for this sub-level in meters above the ellipsoid.
This height should not be confused with a height above Mean Sea Level. When this sub-level is active, the CesiumGeoreference will adopt this origin.
void UCesiumSubLevelComponent::SetOriginLatitude | ( | double | value | ) |
Sets the latitude of the georeference origin for this sub-level in degrees, in the range [-90, 90].
When this sub-level is active, the CesiumGeoreference will adopt this origin.
void UCesiumSubLevelComponent::SetOriginLongitude | ( | double | value | ) |
Sets the longitude of the georeference origin for this sub-level in degrees, in the range [-180, 180].
When this sub-level is active, the CesiumGeoreference will adopt this origin.
void UCesiumSubLevelComponent::SetOriginLongitudeLatitudeHeight | ( | const FVector & | longitudeLatitudeHeight | ) |
Sets the longitude (X), latitude (Y), and height (Z) of this sub-level's georeference origin.
When this sub-level is active, the CesiumGeoreference will adopt this origin. Longitude and latitude are in degrees. Height is in meters above the ellipsoid, which should not be confused with meters above Mean Sea Level.
void UCesiumSubLevelComponent::UpdateGeoreferenceIfSubLevelIsActive | ( | ) |
If this sub-level is currently the active one, this method will copy its origin to the georeference's origin.
Otherwise, it does nothing.