![]() |
Cesium for Unity 1.15.2
|
Controls how global geospatial coordinates are mapped to coordinates in the Unity scene. More...
Public Member Functions | |
void | SetOriginEarthCenteredEarthFixed (double x, double y, double z) |
Sets the origin of the coordinate system to particular ecefX, ecefY, ecefZ coordinates in the Earth-Centered, Earth-Fixed (ECEF) frame. | |
void | SetOriginLongitudeLatitudeHeight (double longitude, double latitude, double height) |
Sets the origin of the coordinate system to a particular longitude, latitude, and height. | |
void | AddGlobeAnchor (CesiumGlobeAnchor globeAnchor) |
Register a globe anchor with this georeference. | |
void | RemoveGlobeAnchor (CesiumGlobeAnchor globeAnchor) |
Deregisters a globe anchor with this georeference, so the globe anchor will no longer be updated when the georeference origin changes. | |
void | Initialize () |
Initializes this georeference so that other objects may use it to locate the globe in the world. | |
void | ReloadEllipsoid () |
Called when the ellipsoid override property has changed. | |
void | MoveOrigin () |
Recomputes the coordinate system based on an updated origin. | |
double3 | TransformUnityPositionToEarthCenteredEarthFixed (double3 unityPosition) |
Transform a Unity position to Earth-Centered, Earth-Fixed (ECEF) coordinates. | |
double3 | TransformEarthCenteredEarthFixedPositionToUnity (double3 earthCenteredEarthFixed) |
Transform an Earth-Centered, Earth-Fixed position to Unity coordinates. | |
double3 | TransformUnityDirectionToEarthCenteredEarthFixed (double3 unityDirection) |
Transform a Unity direction to a direction in Earth-Centered, Earth-Fixed (ECEF) coordinates. | |
double3 | TransformEarthCenteredEarthFixedDirectionToUnity (double3 earthCenteredEarthFixedDirection) |
Transform an Earth-Centered, Earth-Fixed direction to Unity coordinates. | |
Properties | |
CesiumGeoreferenceOriginPlacement | originPlacement [get, set] |
The placement of this GameObject's origin (coordinate 0,0,0) within the tileset. | |
CesiumGeoreferenceOriginAuthority | originAuthority [get, set] |
Identifies which set of coordinates authoritatively defines the origin of this georeference. | |
double | latitude [get, set] |
The latitude of the origin of the coordinate system, in degrees, in the range -90 to 90. | |
double | longitude [get, set] |
The longitude of the origin of the coordinate system, in degrees, in the range -180 to 180. | |
double | height [get, set] |
The height in the origin of the coordinate system, in meters above the ellipsoid. | |
double | ecefX [get, set] |
The Earth-Centered, Earth-Fixed X coordinate of the origin of the coordinate system, in meters. | |
double | ecefY [get, set] |
The Earth-Centered, Earth-Fixed Y coordinate of the origin of the coordinate system, in meters. | |
double | ecefZ [get, set] |
The Earth-Centered, Earth-Fixed Z coordinate of the origin of the coordinate system, in meters. | |
double | scale [get, set] |
The scale of the globe in the Unity world. | |
double4x4 | localToEcefMatrix [get] |
double4x4 | ecefToLocalMatrix [get] |
CesiumEllipsoid | ellipsoid [get, set] |
The CesiumEllipsoid that is referenced. | |
Events | |
Action | changed |
An event raised when the georeference changes. | |
Controls how global geospatial coordinates are mapped to coordinates in the Unity scene.
This component should be added to a GameObject that is a parent of all GameObjects with the Cesium3DTileset or CesiumGlobeAnchor components.
Internally, Cesium uses a global Earth-centered, Earth-fixed (ECEF) ellipsoid-centered coordinate system, where the ellipsoid is usually the World Geodetic System 1984 (WGS84) ellipsoid. This is a right-handed system centered at the Earth's center of mass, where +X is in the direction of the intersection of the Equator and the Prime Meridian (zero degrees longitude), +Y is in the direction of the intersection of the Equator and +90 degrees longitude, and +Z is through the North Pole.
This component controls how this coordinate system is mapped into the Unity world. It creates a left-handed, Unity-friendly coordinate system centered at the specified georeference origin, where +X points East, +Y points up, and +Z points North, and transforms coordinates between that coordinate system and ECEF.
The Unity
is applied after the georeference transformation, in the normal way. For example, if a Cesium3DTileset's
property is set to
, then that tileset will be shifted East 5000 units and up 100 units. If the CesiumGeoreference has a scale of 0.5, the entire globe will be half of its normal size in the Unity world.
Definition at line 89 of file CesiumGeoreference.cs.
|
inline |
Register a globe anchor with this georeference.
When the georeference origin changes, the registered anchor will be updated accordingly.
This is called automatically by CesiumGlobeAnchor.OnEnable and usually does not need to be called directly.
globeAnchor | The globe anchor. |
Definition at line 417 of file CesiumGeoreference.cs.
|
inline |
Initializes this georeference so that other objects may use it to locate the globe in the world.
It is not usually necessary to call this directly because it is called automatically in OnEnable. However, when other objects in the same scene need to use this georeference from their own
, it is possible that the other object's OnEnable will be called before the georeference's, leading to incorrect georeferencing. Calling this method explicitly will avoid this problem.
However, this method should not be called prior to the scene's
phase.
If this component has already been initialized, this method does nothing.
Definition at line 454 of file CesiumGeoreference.cs.
|
inline |
Recomputes the coordinate system based on an updated origin.
It is usually not necessary to call this directly as it is called automatically when needed.
Definition at line 491 of file CesiumGeoreference.cs.
|
inline |
Called when the ellipsoid override property has changed.
Definition at line 467 of file CesiumGeoreference.cs.
|
inline |
Deregisters a globe anchor with this georeference, so the globe anchor will no longer be updated when the georeference origin changes.
This is called automatically by CesiumGlobeAnchor.OnDisable and usually does not need to be called directly.
globeAnchor | The globe anchor. |
Definition at line 431 of file CesiumGeoreference.cs.
|
inline |
Sets the origin of the coordinate system to particular ecefX, ecefY, ecefZ coordinates in the Earth-Centered, Earth-Fixed (ECEF) frame.
Calling this method is more efficient than setting the properties individually.
x | The X coordinate in meters. |
y | The Y coordinate in meters. |
z | The Z coordinate in meters. |
Definition at line 378 of file CesiumGeoreference.cs.
|
inline |
Sets the origin of the coordinate system to a particular longitude, latitude, and height.
Calling this method is more efficient than setting the properties individually.
longitude | The longitude in degrees, in the range -180 to 180. |
latitude | The latitude in degrees, in the range -90 to 90. |
height | The height in meters above the ellipsoid. Do not confuse this with a geoid height or height above mean sea level, which can be tens of meters higher or lower depending on where in the world the object is located. |
Definition at line 400 of file CesiumGeoreference.cs.
|
inline |
Transform an Earth-Centered, Earth-Fixed direction to Unity coordinates.
The resulting direction should generally not be interpreted as a Unity world direction, but rather a direction expressed in some parent GameObject's reference frame as defined by its Transform. This way, the chain of Unity transforms orients the "globe" in the Unity world.
earthCenteredEarthFixedDirection | The direction in ECEF coordinates. |
Definition at line 620 of file CesiumGeoreference.cs.
|
inline |
Transform an Earth-Centered, Earth-Fixed position to Unity coordinates.
The resulting position should generally not be interpreted as a Unity world position, but rather a position expressed in some parent GameObject's reference frame as defined by its Transform. This way, the chain of Unity transforms places and orients the "globe" in the Unity world.
earthCenteredEarthFixed | The ECEF coordinates in meters. |
Definition at line 590 of file CesiumGeoreference.cs.
|
inline |
Transform a Unity direction to a direction in Earth-Centered, Earth-Fixed (ECEF) coordinates.
The direction should generally not be a Unity world direction, but rather a direction expressed in some parent GameObject's reference frame as defined by its Transform. This way, the chain of Unity transforms orients the "globe" in the Unity world.
unityDirection | The Unity direction to convert. |
Definition at line 605 of file CesiumGeoreference.cs.
|
inline |
Transform a Unity position to Earth-Centered, Earth-Fixed (ECEF) coordinates.
The position should generally not be a Unity world position, but rather a position expressed in some parent GameObject's reference frame as defined by its Transform. This way, the chain of Unity transforms places and orients the "globe" in the Unity world.
unityPosition | The Unity position to convert. |
Definition at line 575 of file CesiumGeoreference.cs.
|
get |
Definition at line 331 of file CesiumGeoreference.cs.
|
getset |
The Earth-Centered, Earth-Fixed X coordinate of the origin of the coordinate system, in meters.
This property only takes effect if CesiumGeoreference.originPlacement is set to CesiumGeoreferenceOriginPlacement.CartographicOrigin and originAuthority is set to CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed. Setting this property changes the originAuthority accordingly.
Definition at line 254 of file CesiumGeoreference.cs.
|
getset |
The Earth-Centered, Earth-Fixed Y coordinate of the origin of the coordinate system, in meters.
This property only takes effect if CesiumGeoreference.originPlacement is set to CesiumGeoreferenceOriginPlacement.CartographicOrigin and originAuthority is set to CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed. Setting this property changes the originAuthority accordingly.
Definition at line 274 of file CesiumGeoreference.cs.
|
getset |
The Earth-Centered, Earth-Fixed Z coordinate of the origin of the coordinate system, in meters.
This property only takes effect if CesiumGeoreference.originPlacement is set to CesiumGeoreferenceOriginPlacement.CartographicOrigin and originAuthority is set to CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed. Setting this property changes the originAuthority accordingly.
Definition at line 294 of file CesiumGeoreference.cs.
|
getset |
The CesiumEllipsoid that is referenced.
Definition at line 343 of file CesiumGeoreference.cs.
|
getset |
The height in the origin of the coordinate system, in meters above the ellipsoid.
Do not confuse this with a geoid height or height above mean sea level, which can be tens of meters higher or lower depending on where in the world the object is located.
This property only takes effect if CesiumGeoreference.originPlacement is set to CesiumGeoreferenceOriginPlacement.CartographicOrigin and originAuthority is set to CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight. Setting this property changes the originAuthority accordingly.
Definition at line 234 of file CesiumGeoreference.cs.
|
getset |
The latitude of the origin of the coordinate system, in degrees, in the range -90 to 90.
This property only takes effect if CesiumGeoreference.originPlacement is set to CesiumGeoreferenceOriginPlacement.CartographicOrigin and originAuthority is set to CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight. Setting this property changes the originAuthority accordingly.
Definition at line 192 of file CesiumGeoreference.cs.
|
get |
Definition at line 322 of file CesiumGeoreference.cs.
|
getset |
The longitude of the origin of the coordinate system, in degrees, in the range -180 to 180.
This property only takes effect if CesiumGeoreference.originPlacement is set to CesiumGeoreferenceOriginPlacement.CartographicOrigin and originAuthority is set to CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight. Setting this property changes the originAuthority accordingly.
Definition at line 212 of file CesiumGeoreference.cs.
|
getset |
Identifies which set of coordinates authoritatively defines the origin of this georeference.
Setting this property changes the originPlacement accordingly.
Definition at line 172 of file CesiumGeoreference.cs.
|
getset |
The placement of this GameObject's origin (coordinate 0,0,0) within the tileset.
3D Tiles tilesets often use Earth-centered, Earth-fixed coordinates, such that the tileset content is in a small bounding volume 6-7 million meters (the radius of the Earth) away from the coordinate system origin. This property allows an alternative position, other than the tileset's true origin, to be treated as the origin for the purpose of this GameObject. Using this property will preserve vertex precision (and thus avoid jittering) much better than setting the GameObject's Transform property.
Definition at line 155 of file CesiumGeoreference.cs.
|
getset |
The scale of the globe in the Unity world.
If this value is 0.5, for example, one meter on the globe occupies half a meter in the Unity world.
The globe can also be scaled by modifying the georeference's Transform, but setting this property instead will do a better job of preserving precision.
Definition at line 312 of file CesiumGeoreference.cs.
Action CesiumForUnity.CesiumGeoreference.changed |
An event raised when the georeference changes.
Definition at line 366 of file CesiumGeoreference.cs.