Class Character
Characters are Pawns that have a mesh, collision, and built-in movement logic.
Inheritance
Inherited Members
Namespace: UE4.Engine
Assembly: UE4DotNet.dll
Syntax
public class Character : Pawn
Remarks
They are responsible for all physical interaction between the player or AI and the world, and also implement basic networking and input models. They are designed for a vertically-oriented player representation that can walk, jump, fly, and swim through the world using CharacterMovementComponent.
@see APawn, UCharacterMovementComponent @see https://docs.unrealengine.com/latest/INT/Gameplay/Framework/Pawn/Character/
Properties
| Improve this Doc View SourceAnimRootMotionTranslationScale
Scale to apply to root motion translation on this Character
Declaration
public float AnimRootMotionTranslationScale { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
ArrowComponent
Component shown in the editor only to indicate character facing
Declaration
public ArrowComponent ArrowComponent { get; set; }
Property Value
Type | Description |
---|---|
ArrowComponent |
BasedMovement
Info about our current movement base (object we are standing on).
Declaration
public BasedMovementInfo BasedMovement { get; set; }
Property Value
Type | Description |
---|---|
BasedMovementInfo |
BaseRotationOffset
Saved rotation offset of mesh.
Declaration
public Quat BaseRotationOffset { get; set; }
Property Value
Type | Description |
---|---|
Quat |
BaseTranslationOffset
Saved translation offset of mesh.
Declaration
public Vector BaseTranslationOffset { get; set; }
Property Value
Type | Description |
---|---|
Vector |
bClientCheckEncroachmentOnNetUpdate
Declaration
public bool bClientCheckEncroachmentOnNetUpdate { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bClientResimulateRootMotion
Declaration
public bool bClientResimulateRootMotion { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bClientResimulateRootMotionSources
Declaration
public bool bClientResimulateRootMotionSources { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bClientUpdating
Declaration
public bool bClientUpdating { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bClientWasFalling
Declaration
public bool bClientWasFalling { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bInBaseReplication
Declaration
public bool bInBaseReplication { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bIsCrouched
Declaration
public bool bIsCrouched { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
bPressedJump
Declaration
public bool bPressedJump { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
bProxyIsJumpForceApplied
Declaration
public bool bProxyIsJumpForceApplied { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bServerMoveIgnoreRootMotion
Declaration
public bool bServerMoveIgnoreRootMotion { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bSimGravityDisabled
Declaration
public bool bSimGravityDisabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
bWasJumping
Declaration
public bool bWasJumping { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
CapsuleComponent
The CapsuleComponent being used for movement collision (by CharacterMovement). Always treated as being vertically aligned in simple collision check functions.
Declaration
public CapsuleComponent CapsuleComponent { get; }
Property Value
Type | Description |
---|---|
CapsuleComponent |
CharacterMovement
Movement component used for movement logic in various movement modes (walking, falling, etc), containing relevant settings and functions to control movement.
Declaration
public CharacterMovementComponent CharacterMovement { get; }
Property Value
Type | Description |
---|---|
CharacterMovementComponent |
ClientRootMotionParams
For LocallyControlled Autonomous clients. Saved root motion data to be used by SavedMoves.
Declaration
public RootMotionMovementParams ClientRootMotionParams { get; set; }
Property Value
Type | Description |
---|---|
RootMotionMovementParams |
CrouchedEyeHeight
Default crouched eye height
Declaration
public float CrouchedEyeHeight { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
DefaultObject
Get UE4 Default Object for this Class
Declaration
public static Character DefaultObject { get; }
Property Value
Type | Description |
---|---|
Character |
JumpCurrentCount
Tracks the current number of jumps performed.
Declaration
public int JumpCurrentCount { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
This is incremented in CheckJumpInput, used in CanJump_Implementation, and reset in OnMovementModeChanged. When providing overrides for these methods, it's recommended to either manually increment / reset this value, or call the Super:: method.
JumpForceTimeRemaining
Amount of jump force time remaining, if JumpMaxHoldTime > 0.
Declaration
public float JumpForceTimeRemaining { get; }
Property Value
Type | Description |
---|---|
System.Single |
JumpKeyHoldTime
Jump key Held Time.
Declaration
public float JumpKeyHoldTime { get; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
This is the time that the player has held the jump key, in seconds.
JumpMaxCount
The max number of jumps the character can perform.
Declaration
public int JumpMaxCount { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Remarks
Note that if JumpMaxHoldTime is non zero and StopJumping is not called, the player may be able to perform and unlimited number of jumps. Therefore it is usually best to call StopJumping() when jump input has ceased (such as a button up event).
JumpMaxHoldTime
The max time the jump key can be held.
Declaration
public float JumpMaxHoldTime { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
Remarks
Note that if StopJumping() is not called before the max jump hold time is reached, then the character will carry on receiving vertical velocity. Therefore it is usually best to call StopJumping() when jump input has ceased (such as a button up event).
Mesh
The main skeletal mesh associated with this Character (optional sub-object).
Declaration
public SkeletalMeshComponent Mesh { get; }
Property Value
Type | Description |
---|---|
SkeletalMeshComponent |
ProxyJumpForceStartedTime
Track last time a jump force started for a proxy.
Declaration
public float ProxyJumpForceStartedTime { get; }
Property Value
Type | Description |
---|---|
System.Single |
ReplayLastTransformUpdateTimeStamp
Replay Last Transform Update Time Stamp
Declaration
public float ReplayLastTransformUpdateTimeStamp { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
ReplicatedBasedMovement
Replicated version of relative movement. Read-only on simulated proxies!
Declaration
public BasedMovementInfo ReplicatedBasedMovement { get; set; }
Property Value
Type | Description |
---|---|
BasedMovementInfo |
ReplicatedMovementMode
CharacterMovement MovementMode (and custom mode) replicated for simulated proxies. Use CharacterMovementComponent::UnpackNetworkMovementMode() to translate it.
Declaration
public byte ReplicatedMovementMode { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
ReplicatedServerLastTransformUpdateTimeStamp
CharacterMovement ServerLastTransformUpdateTimeStamp value, replicated to simulated proxies.
Declaration
public float ReplicatedServerLastTransformUpdateTimeStamp { get; set; }
Property Value
Type | Description |
---|---|
System.Single |
RepRootMotion
Replicated Root Motion montage
Declaration
public RepRootMotionMontage RepRootMotion { get; set; }
Property Value
Type | Description |
---|---|
RepRootMotionMontage |
SavedRootMotion
For LocallyControlled Autonomous clients.
Declaration
public RootMotionSourceGroup SavedRootMotion { get; set; }
Property Value
Type | Description |
---|---|
RootMotionSourceGroup |
Remarks
During a PerformMovement() after root motion is prepared, we save it off into this and then record it into our SavedMoves. During SavedMove playback we use it as our "Previous Move" SavedRootMotion which includes last received root motion from the Server
StaticClass
Get UE4 Class
Declaration
public static Class StaticClass { get; }
Property Value
Type | Description |
---|---|
Class |
Methods
| Improve this Doc View SourceCacheInitialMeshOffset(Vector, Rotator)
Cache mesh offset from capsule.
Declaration
public void CacheInitialMeshOffset(Vector MeshRelativeLocation, Rotator MeshRelativeRotation)
Parameters
Type | Name | Description |
---|---|---|
Vector | MeshRelativeLocation | |
Rotator | MeshRelativeRotation |
Remarks
This is used as the target for network smoothing interpolation, when the mesh is offset with lagged smoothing. This is automatically called during initialization; call this at runtime if you intend to change the default mesh offset from the capsule. @see GetBaseTranslationOffset(), GetBaseRotationOffset()
CanJump()
Check if the character can jump in the current state.
Declaration
public bool CanJump()
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
The default implementation may be overridden or extended by implementing the custom CanJump event in Blueprints.
@Return Whether the character can jump in the current state.
Crouch(Boolean)
Request the character to start crouching.
Declaration
public void Crouch(bool bClientSimulation)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | bClientSimulation |
Remarks
The request is processed on the next update of the CharacterMovementComponent. @see OnStartCrouch @see IsCrouched @see CharacterMovement->WantsToCrouch
GetAnimRootMotionTranslationScale()
Returns current value of AnimRootMotionScale
Declaration
public float GetAnimRootMotionTranslationScale()
Returns
Type | Description |
---|---|
System.Single |
GetBaseRotationOffsetRotator()
Get the saved rotation offset of mesh. This is how much extra rotation is applied from the capsule rotation.
Declaration
public Rotator GetBaseRotationOffsetRotator()
Returns
Type | Description |
---|---|
Rotator |
GetBaseTranslationOffset()
Get the saved translation offset of mesh. This is how much extra offset is applied from the center of the capsule.
Declaration
public Vector GetBaseTranslationOffset()
Returns
Type | Description |
---|---|
Vector |
GetCurrentMontage()
Return current playing Montage *
Declaration
public AnimMontage GetCurrentMontage()
Returns
Type | Description |
---|---|
AnimMontage |
IsJumpProvidingForce()
True if jump is actively providing a force, such as when the jump key is held and the time it has been held is less than JumpMaxHoldTime.
Declaration
public bool IsJumpProvidingForce()
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
@see CharacterMovement->IsFalling
IsPlayingNetworkedRootMotionMontage()
True if we are playing Root Motion right now, through a Montage with RootMotionMode == ERootMotionMode::RootMotionFromMontagesOnly.
Declaration
public bool IsPlayingNetworkedRootMotionMontage()
Returns
Type | Description |
---|---|
System.Boolean |
Remarks
This means code path for networked root motion is enabled.
IsPlayingRootMotion()
True if we are playing Root Motion right now
Declaration
public bool IsPlayingRootMotion()
Returns
Type | Description |
---|---|
System.Boolean |
Jump()
Make the character jump on the next update.
Declaration
public void Jump()
Remarks
If you want your character to jump according to the time that the jump key is held, then you can set JumpKeyHoldTime to some non-zero value. Make sure in this case to call StopJumping() when you want the jump's z-velocity to stop being applied (such as on a button up event), otherwise the character will carry on receiving the velocity until JumpKeyHoldTime is reached.
LaunchCharacter(Vector, Boolean, Boolean)
Set a pending launch velocity on the Character.
Declaration
public void LaunchCharacter(Vector LaunchVelocity, bool bXYOverride, bool bZOverride)
Parameters
Type | Name | Description |
---|---|---|
Vector | LaunchVelocity | |
System.Boolean | bXYOverride | |
System.Boolean | bZOverride |
Remarks
This velocity will be processed on the next CharacterMovementComponent tick, and will set it to the "falling" state. Triggers the OnLaunched event. @PARAM LaunchVelocity is the velocity to impart to the Character @PARAM bXYOverride if true replace the XY part of the Character's velocity instead of adding to it. @PARAM bZOverride if true replace the Z component of the Character's velocity instead of adding to it.
New(UObject, Name)
Spawn an object of this class
Declaration
public static Character New(UObject obj = null, Name name = default(Name))
Parameters
Type | Name | Description |
---|---|---|
UObject | obj | |
Name | name |
Returns
Type | Description |
---|---|
Character |
PlayAnimMontage(AnimMontage, Single, Name)
Play Animation Montage on the character mesh *
Declaration
public float PlayAnimMontage(AnimMontage AnimMontage, float InPlayRate, Name StartSectionName)
Parameters
Type | Name | Description |
---|---|---|
AnimMontage | AnimMontage | |
System.Single | InPlayRate | |
Name | StartSectionName |
Returns
Type | Description |
---|---|
System.Single |
StopAnimMontage(AnimMontage)
Stop Animation Montage. If nullptr, it will stop what's currently active. The Blend Out Time is taken from the montage asset that is being stopped. *
Declaration
public void StopAnimMontage(AnimMontage AnimMontage)
Parameters
Type | Name | Description |
---|---|---|
AnimMontage | AnimMontage |
StopJumping()
Stop the character from jumping on the next update.
Declaration
public void StopJumping()
Remarks
Call this from an input event (such as a button 'up' event) to cease applying jump Z-velocity. If this is not called, then jump z-velocity will be applied until JumpMaxHoldTime is reached.
UnCrouch(Boolean)
Request the character to stop crouching.
Declaration
public void UnCrouch(bool bClientSimulation)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | bClientSimulation |
Remarks
The request is processed on the next update of the CharacterMovementComponent. @see OnEndCrouch @see IsCrouched @see CharacterMovement->WantsToCrouch
Events
| Improve this Doc View SourceCanJumpInternal
Customizable event to check if the character can jump in the current state.
Declaration
public event Character.CanJumpInternal_delegate CanJumpInternal
Event Type
Type | Description |
---|---|
Character.CanJumpInternal_delegate |
Remarks
Default implementation returns true if the character is on the ground and not crouching, has a valid CharacterMovementComponent and CanEverJump() returns true. Default implementation also allows for 'hold to jump higher' functionality: As well as returning true when on the ground, it also returns true when GetMaxJumpTime is more than zero and IsJumping returns true.
@Return Whether the character can jump in the current state.
K2_OnEndCrouch
Event when Character stops crouching.
Declaration
public event Character.K2_OnEndCrouch_delegate K2_OnEndCrouch
Event Type
Type | Description |
---|---|
Character.K2_OnEndCrouch_delegate |
Remarks
@param HalfHeightAdjust difference between default collision half-height, and actual crouched capsule half-height. @param ScaledHalfHeightAdjust difference after component scale is taken in to account.
K2_OnMovementModeChanged
Called from CharacterMovementComponent to notify the character that the movement mode has changed.
Declaration
public event Character.K2_OnMovementModeChanged_delegate K2_OnMovementModeChanged
Event Type
Type | Description |
---|---|
Character.K2_OnMovementModeChanged_delegate |
Remarks
@param PrevMovementMode Movement mode before the change @param NewMovementMode New movement mode @param PrevCustomMode Custom mode before the change (applicable if PrevMovementMode is Custom) @param NewCustomMode New custom mode (applicable if NewMovementMode is Custom)
K2_OnStartCrouch
Event when Character crouches.
Declaration
public event Character.K2_OnStartCrouch_delegate K2_OnStartCrouch
Event Type
Type | Description |
---|---|
Character.K2_OnStartCrouch_delegate |
Remarks
@param HalfHeightAdjust difference between default collision half-height, and actual crouched capsule half-height. @param ScaledHalfHeightAdjust difference after component scale is taken in to account.
K2_UpdateCustomMovement
Event for implementing custom character movement mode.
Declaration
public event Character.K2_UpdateCustomMovement_delegate K2_UpdateCustomMovement
Event Type
Type | Description |
---|---|
Character.K2_UpdateCustomMovement_delegate |
Remarks
Called by CharacterMovement if MovementMode is set to Custom. @note C++ code should override UCharacterMovementComponent::PhysCustom() instead. @see UCharacterMovementComponent::PhysCustom()
OnJumped
Event fired when the character has just started jumping
Declaration
public event Character.OnJumped_delegate OnJumped
Event Type
Type | Description |
---|---|
Character.OnJumped_delegate |
OnLanded
Called upon landing when falling, to perform actions based on the Hit result.
Declaration
public event Character.OnLanded_delegate OnLanded
Event Type
Type | Description |
---|---|
Character.OnLanded_delegate |
Remarks
Note that movement mode is still "Falling" during this event. Current Velocity value is the velocity at the time of landing. Consider OnMovementModeChanged() as well, as that can be used once the movement mode changes to the new mode (most likely Walking).
@param Hit Result describing the landing that resulted in a valid landing spot. @see OnMovementModeChanged()
OnLaunched
Let blueprint know that we were launched
Declaration
public event Character.OnLaunched_delegate OnLaunched
Event Type
Type | Description |
---|---|
Character.OnLaunched_delegate |
OnWalkingOffLedge
Event fired when the Character is walking off a surface and is about to fall because CharacterMovement->CurrentFloor became unwalkable.
Declaration
public event Character.OnWalkingOffLedge_delegate OnWalkingOffLedge
Event Type
Type | Description |
---|---|
Character.OnWalkingOffLedge_delegate |
Remarks
If CharacterMovement->MovementMode does not change during this event then the character will automatically start falling afterwards. @note Z velocity is zero during walking movement, and will be here as well. Another velocity can be computed here if desired and will be used when starting to fall.
@param PreviousFloorImpactNormal Normal of the previous walkable floor. @param PreviousFloorContactNormal Normal of the contact with the previous walkable floor. @param PreviousLocation Previous character location before movement off the ledge. @param TimeTick Time delta of movement update resulting in moving off the ledge.
Operators
| Improve this Doc View SourceImplicit(IntPtr to Character)
Convert from IntPtr to UObject
Declaration
public static implicit operator Character(IntPtr p)
Parameters
Type | Name | Description |
---|---|---|
System.IntPtr | p |
Returns
Type | Description |
---|---|
Character |