GlobeAwareDefaultPawn - jgoffeney/Cesium4Unreal GitHub Wiki

Back

Description

The Dynamic Pawn is a GlobeAwareDefaultPawn (which is a DefaultPawn) and it is an Unreal Pawn which moves in relation to the globe rather than in Cartesian coordinates.

An Unreal Pawn does not have a default movement component but a DefaultPawn adds a spherical collision and built-in flying movement.

Public Functions

GetViewRotation

Combines the current controller and pawn rotations and transforms the result to Unreal world angles (yaw, pitch, roll).

GetBaseAimRotation

Just calls GetViewRotation.

MoveForward

Moves the pawn along its local Y axis by calling _moveAlongViewAxis.

MoveRight

Moves the pawn along its local X axis by calling _moveAlongViewAxis.

MoveUp_World

This first finds the surface normal vector of the pawn's location projected onto the globe. It then converts it from ECEF coordinates to Unreal coordinates and calls _moveAlongVector.

Private Functions

_moveAlongVector

It is essentially a wrapper for the Pawn function AddMovementInput which moves the Pawn in the world space based on the supplied vector and scale value.

_moveAlongViewAxis

Gets the current world rotation direction for this object, extracts the vector along a local axis, and calls _moveAlongVector with the direction vector and the movement value.

Movement

The DefaultPawn adds flight functionality to a Pawn. When you press a movement button it uses the Pawn's

Basic movement is done with key pressed via the Move functions which calls _moveAlongViewAxis and then _moveAlongVector.

Pawn.AddMovementInput

UPawnMovementComponent.AddInputVector

Pawn.Internal_AddMovementInput

Adds the input vector to ControlInputVector which is then processed. It does not directly apply a new location.