UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Character.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
9#include "UObject/CoreNet.h"
11#include "Engine/EngineTypes.h"
13#include "GameFramework/Actor.h"
14#include "GameFramework/Pawn.h"
18#include "Character.generated.h"
19
20class ACharacter;
21class AController;
23class UAnimMontage;
24class UArrowComponent;
28class UPrimitiveComponent;
29class USkeletalMeshComponent;
33
38
39// CVars
44
46USTRUCT()
48{
50
51
52 UPROPERTY()
54
56 UPROPERTY()
57 bool bIsActive = false;
58
60 UPROPERTY()
61 bool bRelativePosition = false;
62
64 UPROPERTY()
65 bool bRelativeRotation = false;
66
68 UPROPERTY()
69 float Position = 0.f;
70
72 UPROPERTY()
74
76 UPROPERTY()
78
80 UPROPERTY()
81 TObjectPtr<UPrimitiveComponent> MovementBase = nullptr;
82
84 UPROPERTY()
85 FName MovementBaseBoneName;
86
88 UPROPERTY()
89 FRootMotionSourceGroup AuthoritativeRootMotion;
90
92 UPROPERTY()
94
96 UPROPERTY()
98
100 void Clear()
101 {
102 bIsActive = false;
103 Animation = nullptr;
104 AuthoritativeRootMotion.Clear();
105 }
106
108 bool HasRootMotion() const
109 {
110 return (Animation != nullptr);
111 }
112
113 UAnimMontage* GetAnimMontage() const;
114};
115
116USTRUCT()
129
130
133{
135 ENGINE_API bool IsDynamicBase(const UPrimitiveComponent* MovementBase);
136
138 ENGINE_API bool IsSimulatedBase(const UPrimitiveComponent* MovementBase);
139
141 inline bool UseRelativeLocation(const UPrimitiveComponent* MovementBase)
142 {
143 return IsDynamicBase(MovementBase);
144 }
145
147 ENGINE_API void AddTickDependency(FTickFunction& BasedObjectTick, UPrimitiveComponent* NewBase);
148
150 ENGINE_API void RemoveTickDependency(FTickFunction& BasedObjectTick, UPrimitiveComponent* OldBase);
151
153 ENGINE_API FVector GetMovementBaseVelocity(const UPrimitiveComponent* MovementBase, const FName BoneName);
154
156 ENGINE_API FVector GetMovementBaseTangentialVelocity(const UPrimitiveComponent* MovementBase, const FName BoneName, const FVector& WorldLocation);
157
159 ENGINE_API bool GetMovementBaseTransform(const UPrimitiveComponent* MovementBase, const FName BoneName, FVector& OutLocation, FQuat& OutQuat);
160
162 ENGINE_API bool TransformLocationToWorld(const UPrimitiveComponent* MovementBase, const FName BoneName, const FVector& LocalLocation, FVector& OutLocationWorldSpace);
163
165 ENGINE_API bool TransformLocationToLocal(const UPrimitiveComponent* MovementBase, const FName BoneName, const FVector& WorldSpaceLocation, FVector& OutLocalLocation);
166
168 ENGINE_API bool TransformDirectionToWorld(const UPrimitiveComponent* MovementBase, const FName BoneName, const FVector& LocalDirection, FVector& OutDirectionWorldSpace);
169
171 ENGINE_API bool TransformDirectionToLocal(const UPrimitiveComponent* MovementBase, const FName BoneName, const FVector& WorldSpaceDirection, FVector& OutLocalDirection);
172}
173
175USTRUCT()
177{
179
180
181 UPROPERTY()
182 uint16 BaseID = 0;
183
185 UPROPERTY()
186 uint8 bServerHasBaseComponent:1 = false;
187
189 UPROPERTY()
190 uint8 bRelativeRotation:1 = false;
191
193 UPROPERTY()
194 uint8 bServerHasVelocity:1 = false;
195
197 UPROPERTY()
198 FName BoneName;
199
201 UPROPERTY()
202 TObjectPtr<UPrimitiveComponent> MovementBase = nullptr;
203
205 UPROPERTY()
207
209 UPROPERTY()
211
213 inline bool HasRelativeLocation() const
214 {
215 return MovementBaseUtility::UseRelativeLocation(MovementBase);
216 }
217
219 inline bool HasRelativeRotation() const
220 {
221 return bRelativeRotation && HasRelativeLocation();
222 }
223
225 inline bool IsBaseUnresolved() const
226 {
227 return (MovementBase == nullptr) && bServerHasBaseComponent;
228 }
229};
230
231
240UCLASS(config=Game, BlueprintType, meta=(ShortTooltip="A character is a type of Pawn that includes the ability to walk around."), MinimalAPI)
241class ACharacter : public APawn
242{
244public:
247
248 ENGINE_API virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
249
250 ENGINE_API virtual void GetReplicatedCustomConditionState(FCustomPropertyConditionState& OutActiveState) const override;
251
252private:
254 UPROPERTY(Category=Character, VisibleAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess = "true"))
256
258 UPROPERTY(Category=Character, VisibleAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess = "true"))
260
262 UPROPERTY(Category=Character, VisibleAnywhere, BlueprintReadOnly, meta=(AllowPrivateAccess = "true"))
263 TObjectPtr<UCapsuleComponent> CapsuleComponent;
264
265#if WITH_EDITORONLY_DATA
267 UPROPERTY()
269#endif
270
271public:
272
274 // Server RPC that passes through to CharacterMovement (avoids RPC overhead for components).
275 // The base RPC function (eg 'ServerMove') is auto-generated for clients to trigger the call to the server function,
276 // eventually going to the _Implementation function (which we just pass to the CharacterMovementComponent).
278
279 UFUNCTION(unreliable, server, WithValidation)
280 ENGINE_API void ServerMovePacked(const FCharacterServerMovePackedBits& PackedBits);
281 ENGINE_API void ServerMovePacked_Implementation(const FCharacterServerMovePackedBits& PackedBits);
282 ENGINE_API bool ServerMovePacked_Validate(const FCharacterServerMovePackedBits& PackedBits);
283
285 // Client RPC that passes through to CharacterMovement (avoids RPC overhead for components).
287
288 UFUNCTION(unreliable, client, WithValidation)
289 ENGINE_API void ClientMoveResponsePacked(const FCharacterMoveResponsePackedBits& PackedBits);
290 ENGINE_API void ClientMoveResponsePacked_Implementation(const FCharacterMoveResponsePackedBits& PackedBits);
291 ENGINE_API bool ClientMoveResponsePacked_Validate(const FCharacterMoveResponsePackedBits& PackedBits);
292
293
295 // BEGIN DEPRECATED RPCs that don't use variable sized payloads. Use ServerMovePacked and ClientMoveResponsePacked instead.
297
299 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMove, ServerMovePacked)
300 UFUNCTION(unreliable, server, WithValidation)
302 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMove_Implementation, ServerMovePacked_Implementation)
303 ENGINE_API void ServerMove_Implementation(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);
304 ENGINE_API bool ServerMove_Validate(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);
305
310 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveNoBase, ServerMovePacked)
311 UFUNCTION(unreliable, server, WithValidation)
312 ENGINE_API void ServerMoveNoBase(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, uint8 ClientMovementMode);
313 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveNoBase_Implementation, ServerMovePacked_Implementation)
314 ENGINE_API void ServerMoveNoBase_Implementation(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, uint8 ClientMovementMode);
315 ENGINE_API bool ServerMoveNoBase_Validate(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, uint8 ClientMovementMode);
316
318 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveDual, ServerMovePacked)
319 UFUNCTION(unreliable, server, WithValidation)
321 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveDual_Implementation, ServerMovePacked_Implementation)
324
326 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveDualNoBase, ServerMovePacked)
327 UFUNCTION(unreliable, server, WithValidation)
329 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveDualNoBase_Implementation, ServerMovePacked_Implementation)
332
334 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveDualHybridRootMotion, ServerMovePacked)
335 UFUNCTION(unreliable, server, WithValidation)
337 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveDualHybridRootMotion_Implementation, ServerMovePacked_Implementation)
340
341 /* Resending an (important) old move. Process it if not already processed. */
342 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveOld, ServerMovePacked)
343 UFUNCTION(unreliable, server, WithValidation)
345 DEPRECATED_CHARACTER_MOVEMENT_RPC(ServerMoveOld_Implementation, ServerMovePacked_Implementation)
346 ENGINE_API void ServerMoveOld_Implementation(float OldTimeStamp, FVector_NetQuantize10 OldAccel, uint8 OldMoveFlags);
347 ENGINE_API bool ServerMoveOld_Validate(float OldTimeStamp, FVector_NetQuantize10 OldAccel, uint8 OldMoveFlags);
348
350 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientAckGoodMove, ClientMoveResponsePacked)
351 UFUNCTION(unreliable, client)
352 ENGINE_API void ClientAckGoodMove(float TimeStamp);
353 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientAckGoodMove_Implementation, ClientMoveResponsePacked_Implementation)
354 ENGINE_API void ClientAckGoodMove_Implementation(float TimeStamp);
355
357 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientAdjustPosition, ClientMoveResponsePacked)
358 UFUNCTION(unreliable, client)
359 ENGINE_API void ClientAdjustPosition(float TimeStamp, FVector NewLoc, FVector NewVel, UPrimitiveComponent* NewBase, FName NewBaseBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode);
360 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientAdjustPosition_Implementation, ClientMoveResponsePacked_Implementation)
361 ENGINE_API void ClientAdjustPosition_Implementation(float TimeStamp, FVector NewLoc, FVector NewVel, UPrimitiveComponent* NewBase, FName NewBaseBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode);
362
363 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientVeryShortAdjustPosition, ClientMoveResponsePacked)
364 /* Bandwidth saving version, when velocity is zeroed */
365 UFUNCTION(unreliable, client)
366 ENGINE_API void ClientVeryShortAdjustPosition(float TimeStamp, FVector NewLoc, UPrimitiveComponent* NewBase, FName NewBaseBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode);
367 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientVeryShortAdjustPosition_Implementation, ClientMoveResponsePacked_Implementation)
368 ENGINE_API void ClientVeryShortAdjustPosition_Implementation(float TimeStamp, FVector NewLoc, UPrimitiveComponent* NewBase, FName NewBaseBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode);
369
371 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientAdjustRootMotionPosition, ClientMoveResponsePacked)
372 UFUNCTION(unreliable, client)
373 ENGINE_API void ClientAdjustRootMotionPosition(float TimeStamp, float ServerMontageTrackPosition, FVector ServerLoc, FVector_NetQuantizeNormal ServerRotation, float ServerVelZ, UPrimitiveComponent* ServerBase, FName ServerBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode);
374 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientAdjustRootMotionPosition_Implementation, ClientMoveResponsePacked_Implementation)
375 ENGINE_API void ClientAdjustRootMotionPosition_Implementation(float TimeStamp, float ServerMontageTrackPosition, FVector ServerLoc, FVector_NetQuantizeNormal ServerRotation, float ServerVelZ, UPrimitiveComponent* ServerBase, FName ServerBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode);
376
378 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientAdjustRootMotionSourcePosition, ClientMoveResponsePacked)
379 UFUNCTION(unreliable, client)
380 ENGINE_API void ClientAdjustRootMotionSourcePosition(float TimeStamp, FRootMotionSourceGroup ServerRootMotion, bool bHasAnimRootMotion, float ServerMontageTrackPosition, FVector ServerLoc, FVector_NetQuantizeNormal ServerRotation, float ServerVelZ, UPrimitiveComponent* ServerBase, FName ServerBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode);
381 DEPRECATED_CHARACTER_MOVEMENT_RPC(ClientAdjustRootMotionSourcePosition_Implementation, ClientMoveResponsePacked_Implementation)
382 ENGINE_API void ClientAdjustRootMotionSourcePosition_Implementation(float TimeStamp, FRootMotionSourceGroup ServerRootMotion, bool bHasAnimRootMotion, float ServerMontageTrackPosition, FVector ServerLoc, FVector_NetQuantizeNormal ServerRotation, float ServerVelZ, UPrimitiveComponent* ServerBase, FName ServerBoneName, bool bHasBase, bool bBaseRelativePosition, uint8 ServerMovementMode);
383
385 // END DEPRECATED RPCs
387
388public:
390 inline class USkeletalMeshComponent* GetMesh() const { return Mesh; }
391
394
396 template <class T>
397 inline T* GetCharacterMovement() const
398 {
399 return CastChecked<T>(CharacterMovement, ECastCheckedType::NullAllowed);
400 }
401 inline UCharacterMovementComponent* GetCharacterMovement() const { return CharacterMovement; }
402
405
407 inline class UCapsuleComponent* GetCapsuleComponent() const { return CapsuleComponent; }
408
411
412#if WITH_EDITORONLY_DATA
414 class UArrowComponent* GetArrowComponent() const { return ArrowComponent; }
415#endif
416
418 ENGINE_API virtual void SetBase(UPrimitiveComponent* NewBase, const FName BoneName = NAME_None, bool bNotifyActor=true);
419
425 UFUNCTION(BlueprintCallable, Category=Character)
426 ENGINE_API virtual void CacheInitialMeshOffset(FVector MeshRelativeLocation, FRotator MeshRelativeRotation);
427
428protected:
430 UPROPERTY()
432
434 UPROPERTY(ReplicatedUsing=OnRep_ReplicatedBasedMovement)
435 struct FBasedMovementInfo ReplicatedBasedMovement;
436
438 ENGINE_API FBasedMovementInfo& GetReplicatedBasedMovement_Mutable();
440 ENGINE_API void SetReplicatedBasedMovement(const FBasedMovementInfo& InReplicatedBasedMovement);
441
442public:
444 UFUNCTION()
445 ENGINE_API virtual void OnRep_ReplicatedBasedMovement();
446
448 ENGINE_API virtual void SetReplicateMovement(bool bInReplicateMovement) override;
449
452 virtual bool ShouldReplicateAcceleration() const { return CharacterCVars::EnableCharacterAccelerationReplication != 0; }
453
456 float ReplicatedServerLastTransformUpdateTimeStamp;
457
458 UPROPERTY(ReplicatedUsing=OnRep_ReplayLastTransformUpdateTimeStamp)
459 float ReplayLastTransformUpdateTimeStamp;
460
462 UPROPERTY()
463 FQuat BaseRotationOffset;
464
466 UPROPERTY()
467 FVector BaseTranslationOffset;
468
470 ENGINE_API virtual void BaseChange();
471
474 FVector_NetQuantizeNormal ReplicatedGravityDirection;
475
477 FVector_NetQuantizeNormal PreNetReceivedGravityDirection;
478
481 float AnimRootMotionTranslationScale;
482
484 ENGINE_API void SetReplicatedServerLastTransformUpdateTimeStamp(const float InReplicatedServerLastTransformUpdateTimeStamp);
485
487 ENGINE_API void SetReplayLastTransformUpdateTimeStamp(const float InReplayLastTransformUpdateTimeStamp);
488
490 ENGINE_API void SetReplicatedGravityDirection(const FVector& InReplicatedGravityDirection);
491public:
492 UFUNCTION()
493 ENGINE_API void OnRep_ReplayLastTransformUpdateTimeStamp();
494
496 inline float GetReplicatedServerLastTransformUpdateTimeStamp() const { return ReplicatedServerLastTransformUpdateTimeStamp; }
497
499 inline float GetReplayLastTransformUpdateTimeStamp() const { return ReplayLastTransformUpdateTimeStamp; }
500
502 inline const FBasedMovementInfo& GetBasedMovement() const { return BasedMovement; }
503
505 inline const FBasedMovementInfo& GetReplicatedBasedMovement() const { return ReplicatedBasedMovement; }
506
508 ENGINE_API void SaveRelativeBasedMovement(const FVector& NewRelativeLocation, const FRotator& NewRotation, bool bRelativeRotation);
509
511 inline uint8 GetReplicatedMovementMode() const { return ReplicatedMovementMode; }
512
514 UFUNCTION(BlueprintCallable, Category=Character)
515 FVector GetBaseTranslationOffset() const { return BaseTranslationOffset; }
516
518 virtual FQuat GetBaseRotationOffset() const { return BaseRotationOffset; }
519
521 UFUNCTION(BlueprintCallable, Category=Character, meta=(DisplayName="Get Base Rotation Offset", ScriptName="GetBaseRotationOffset"))
522 FRotator GetBaseRotationOffsetRotator() const { return GetBaseRotationOffset().Rotator(); }
523
525 ENGINE_API virtual FVector GetGravityDirection() const override;
526
528 ENGINE_API virtual FQuat GetGravityTransform() const override;
529
531 ENGINE_API virtual FVector GetReplicatedGravityDirection() const;
532
534 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Camera)
535 float CrouchedEyeHeight;
536
539 UPROPERTY()
540 uint8 bInBaseReplication:1;
541
542public:
544 UPROPERTY(BlueprintReadOnly, replicatedUsing=OnRep_IsCrouched, Category=Character)
545 uint8 bIsCrouched:1;
546
549 uint8 bProxyIsJumpForceApplied : 1;
550
552 UFUNCTION()
553 ENGINE_API virtual void OnRep_IsCrouched();
554
556 UPROPERTY(BlueprintReadOnly, Category=Character)
557 uint8 bPressedJump:1;
558
561 uint8 bClientUpdating:1;
562
565 uint8 bClientWasFalling:1;
566
569 uint8 bClientResimulateRootMotion:1;
570
573 uint8 bClientResimulateRootMotionSources:1;
574
576 UPROPERTY()
577 uint8 bSimGravityDisabled:1;
578
580 uint8 bClientCheckEncroachmentOnNetUpdate:1;
581
584 uint8 bServerMoveIgnoreRootMotion:1;
585
587 UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Transient, Category=Character)
588 uint8 bWasJumping : 1;
589
593 uint8 ReplicatedMovementMode;
594
596 ENGINE_API void SetReplicatedMovementMode(const uint8 InReplicatedMovementMode);
597
598public:
603 UPROPERTY(Transient, BlueprintReadOnly, VisibleInstanceOnly, Category=Character)
604 float JumpKeyHoldTime;
605
607 UPROPERTY(Transient, BlueprintReadOnly, VisibleInstanceOnly, Category=Character)
608 float JumpForceTimeRemaining;
609
611 UPROPERTY(Transient, BlueprintReadOnly, VisibleInstanceOnly, Category=Character)
612 float ProxyJumpForceStartedTime;
613
620 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category=Character, Meta=(ClampMin=0.0, UIMin=0.0))
621 float JumpMaxHoldTime;
622
629 UPROPERTY(EditAnywhere, BlueprintReadWrite, Replicated, Category=Character)
630 int32 JumpMaxCount;
631
638 UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category=Character)
639 int32 JumpCurrentCount;
640
648 UPROPERTY(VisibleInstanceOnly, BlueprintReadOnly, Category = Character)
649 int32 JumpCurrentCountPreJump;
650
652 uint32 NumActorOverlapEventsCounter;
653
654 //~ Begin UObject Interface.
656 //~ End UObject Interface
657
658 //~ Begin AActor Interface.
659 ENGINE_API virtual void BeginPlay() override;
660 ENGINE_API virtual void ClearCrossLevelReferences() override;
661 ENGINE_API virtual void PreNetReceive() override;
662 ENGINE_API virtual void PostNetReceive() override;
663 ENGINE_API virtual void GatherCurrentMovement() override;
664 ENGINE_API virtual void OnRep_ReplicatedMovement() override;
665 ENGINE_API virtual void PostNetReceiveLocationAndRotation() override;
666 ENGINE_API virtual void GetSimpleCollisionCylinder(float& CollisionRadius, float& CollisionHalfHeight) const override;
667 ENGINE_API virtual UActorComponent* FindComponentByClass(const TSubclassOf<UActorComponent> ComponentClass) const override;
668 ENGINE_API virtual void TornOff() override;
669 ENGINE_API virtual void NotifyActorBeginOverlap(AActor* OtherActor);
670 ENGINE_API virtual void NotifyActorEndOverlap(AActor* OtherActor);
671 //~ End AActor Interface
672
673 template<class T>
674 T* FindComponentByClass() const
675 {
676 return AActor::FindComponentByClass<T>();
677 }
678
679 //~ Begin INavAgentInterface Interface
680 ENGINE_API virtual FVector GetNavAgentLocation() const override;
681 //~ End INavAgentInterface Interface
682
683 //~ Begin APawn Interface.
684 ENGINE_API virtual void PostInitializeComponents() override;
685 ENGINE_API virtual UPawnMovementComponent* GetMovementComponent() const override;
686 virtual UPrimitiveComponent* GetMovementBase() const override final { return BasedMovement.MovementBase; }
687 ENGINE_API virtual float GetDefaultHalfHeight() const override;
688 ENGINE_API virtual void TurnOff() override;
689 ENGINE_API virtual void Restart() override;
690 ENGINE_API virtual void PawnClientRestart() override;
691 ENGINE_API virtual void PossessedBy(AController* NewController) override;
692 ENGINE_API virtual void UnPossessed() override;
693 ENGINE_API virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
694 ENGINE_API virtual void DisplayDebug(class UCanvas* Canvas, const FDebugDisplayInfo& DebugDisplay, float& YL, float& YPos) override;
695 ENGINE_API virtual void RecalculateBaseEyeHeight() override;
696 ENGINE_API virtual void UpdateNavigationRelevance() override;
697 //~ End APawn Interface
698
700 ENGINE_API virtual void ApplyDamageMomentum(float DamageTaken, FDamageEvent const& DamageEvent, APawn* PawnInstigator, AActor* DamageCauser);
701
710 UFUNCTION(BlueprintCallable, Category=Character)
711 ENGINE_API virtual void Jump();
712
719 UFUNCTION(BlueprintCallable, Category=Character)
720 ENGINE_API virtual void StopJumping();
721
729 UFUNCTION(BlueprintCallable, Category=Character)
730 ENGINE_API bool CanJump() const;
731
733 inline bool GetProxyIsJumpForceApplied() const { return bProxyIsJumpForceApplied; }
735 ENGINE_API void SetProxyIsJumpForceApplied(const bool bInProxyIsJumpForceApplied);
736
738 ENGINE_API bool IsCrouched() const;
740 ENGINE_API void SetIsCrouched(const bool bInIsCrouched);
741
742protected:
754 UFUNCTION(BlueprintNativeEvent, Category=Character, meta=(DisplayName="CanJump"))
755 ENGINE_API bool CanJumpInternal() const;
756 ENGINE_API virtual bool CanJumpInternal_Implementation() const;
757 ENGINE_API bool JumpIsAllowedInternal() const;
758
759public:
760
762 ENGINE_API virtual void ResetJumpState();
763
768 UFUNCTION(BlueprintCallable, Category=Character)
769 ENGINE_API virtual bool IsJumpProvidingForce() const;
770
772 UFUNCTION(BlueprintCallable, Category=Animation)
773 ENGINE_API virtual float PlayAnimMontage(class UAnimMontage* AnimMontage, float InPlayRate = 1.f, FName StartSectionName = NAME_None);
774
776 UFUNCTION(BlueprintCallable, Category=Animation)
777 ENGINE_API virtual void StopAnimMontage(class UAnimMontage* AnimMontage = nullptr);
778
780 UFUNCTION(BlueprintCallable, Category=Animation)
781 ENGINE_API class UAnimMontage* GetCurrentMontage() const;
782
790 UFUNCTION(BlueprintCallable, Category=Character)
791 ENGINE_API virtual void LaunchCharacter(FVector LaunchVelocity, bool bXYOverride, bool bZOverride);
792
794 UFUNCTION(BlueprintImplementableEvent)
795 ENGINE_API void OnLaunched(FVector LaunchVelocity, bool bXYOverride, bool bZOverride);
796
798 UFUNCTION(BlueprintNativeEvent, Category=Character)
799 ENGINE_API void OnJumped();
800 ENGINE_API virtual void OnJumped_Implementation();
801
803 virtual void Falling() {}
804
806 ENGINE_API virtual void NotifyJumpApex();
807
809 UPROPERTY(BlueprintAssignable, Category=Character)
811
820 ENGINE_API virtual void Landed(const FHitResult& Hit);
821
830 UPROPERTY(BlueprintAssignable, Category=Character)
831 FLandedSignature LandedDelegate;
832
841 UFUNCTION(BlueprintImplementableEvent)
842 ENGINE_API void OnLanded(const FHitResult& Hit);
843
854 UFUNCTION(BlueprintNativeEvent, Category=Character)
855 ENGINE_API void OnWalkingOffLedge(const FVector& PreviousFloorImpactNormal, const FVector& PreviousFloorContactNormal, const FVector& PreviousLocation, float TimeDelta);
856 ENGINE_API virtual void OnWalkingOffLedge_Implementation(const FVector& PreviousFloorImpactNormal, const FVector& PreviousFloorContactNormal, const FVector& PreviousLocation, float TimeDelta);
857
862 virtual void MoveBlockedBy(const FHitResult& Impact) {};
863
870 UFUNCTION(BlueprintCallable, Category=Character, meta=(HidePin="bClientSimulation"))
871 ENGINE_API virtual void Crouch(bool bClientSimulation = false);
872
879 UFUNCTION(BlueprintCallable, Category=Character, meta=(HidePin="bClientSimulation"))
880 ENGINE_API virtual void UnCrouch(bool bClientSimulation = false);
881
883 UFUNCTION(BlueprintCallable, Category=Character)
884 ENGINE_API virtual bool CanCrouch() const;
885
891 ENGINE_API virtual void OnEndCrouch(float HalfHeightAdjust, float ScaledHalfHeightAdjust);
892
898 UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName="OnEndCrouch", ScriptName="OnEndCrouch"))
899 ENGINE_API void K2_OnEndCrouch(float HalfHeightAdjust, float ScaledHalfHeightAdjust);
900
906 ENGINE_API virtual void OnStartCrouch(float HalfHeightAdjust, float ScaledHalfHeightAdjust);
907
913 UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName="OnStartCrouch", ScriptName="OnStartCrouch"))
914 ENGINE_API void K2_OnStartCrouch(float HalfHeightAdjust, float ScaledHalfHeightAdjust);
915
917 ENGINE_API void RecalculateCrouchedEyeHeight();
918
925
927 UPROPERTY(BlueprintAssignable, Category=Character)
928 FMovementModeChangedSignature MovementModeChangedDelegate;
929
937 UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName="OnMovementModeChanged", ScriptName="OnMovementModeChanged"))
939
945 UFUNCTION(BlueprintImplementableEvent, meta=(DisplayName="UpdateCustomMovement", ScriptName="UpdateCustomMovement"))
946 ENGINE_API void K2_UpdateCustomMovement(float DeltaTime);
947
958 UPROPERTY(BlueprintAssignable, Category=Character)
959 FCharacterMovementUpdatedSignature OnCharacterMovementUpdated;
960
962 ENGINE_API virtual bool ShouldNotifyLanded(const struct FHitResult& Hit);
963
965 ENGINE_API virtual void CheckJumpInput(float DeltaTime);
966
968 ENGINE_API virtual void ClearJumpInput(float DeltaTime);
969
978 ENGINE_API virtual float GetJumpMaxHoldTime() const;
979
981 ENGINE_API void ClientCheatWalk();
982 ENGINE_API virtual void ClientCheatWalk_Implementation();
983
985 ENGINE_API void ClientCheatFly();
986 ENGINE_API virtual void ClientCheatFly_Implementation();
987
989 ENGINE_API void ClientCheatGhost();
990 ENGINE_API virtual void ClientCheatGhost_Implementation();
991
993 ENGINE_API void RootMotionDebugClientPrintOnScreen(const FString& InString);
994 ENGINE_API virtual void RootMotionDebugClientPrintOnScreen_Implementation(const FString& InString);
995
996 // Root Motion
997
1006 FRootMotionSourceGroup SavedRootMotion;
1007
1010 FRootMotionMovementParams ClientRootMotionParams;
1011
1015
1020 ENGINE_API int32 FindRootMotionRepMove(const FAnimMontageInstance& ClientMontageInstance) const;
1021
1024
1026 ENGINE_API bool RestoreReplicatedMove(const FSimulatedRootMotionReplicatedMove& RootMotionRepMove);
1027
1033 ENGINE_API virtual void OnUpdateSimulatedPosition(const FVector& OldLocation, const FQuat& OldRotation);
1034
1036 UPROPERTY(ReplicatedUsing=OnRep_RootMotion)
1038
1040 inline const FRepRootMotionMontage& GetRepRootMotion() const { return RepRootMotion; }
1041
1043 ENGINE_API FRepRootMotionMontage& GetRepRootMotion_Mutable();
1045 ENGINE_API void SetRepRootMotion(const FRepRootMotionMontage& InRepRootMotion);
1046
1048 UFUNCTION()
1049 ENGINE_API void OnRep_RootMotion();
1050
1052 ENGINE_API void SimulatedRootMotionPositionFixup(float DeltaSeconds);
1053
1055 ENGINE_API FAnimMontageInstance * GetRootMotionAnimMontageInstance() const;
1056
1058 UFUNCTION(BlueprintCallable, Category=Animation, meta=(DisplayName="Is Playing Anim Root Motion"))
1059 ENGINE_API bool IsPlayingRootMotion() const;
1060
1062 UFUNCTION(BlueprintCallable, Category=Animation)
1063 ENGINE_API bool HasAnyRootMotion() const;
1064
1069 UFUNCTION(BlueprintCallable, Category=Animation)
1070 ENGINE_API bool IsPlayingNetworkedRootMotionMontage() const;
1071
1073 ENGINE_API void SetAnimRootMotionTranslationScale(float InAnimRootMotionTranslationScale = 1.f);
1074
1076 UFUNCTION(BlueprintCallable, Category=Animation)
1077 ENGINE_API float GetAnimRootMotionTranslationScale() const;
1078
1084
1090
1092 ENGINE_API void FillAsyncInput(FCharacterAsyncInput& Input) const;
1093 ENGINE_API void InitializeAsyncOutput(FCharacterAsyncOutput& Output) const;
1094 ENGINE_API void ApplyAsyncOutput(const FCharacterAsyncOutput& Output);
1095};
#define DEPRECATED_CHARACTER_MOVEMENT_RPC(DeprecatedFunction, NewFunction)
Definition CharacterMovementReplication.h:29
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE(DelegateName)
Definition DelegateCombinations.h:38
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(DelegateName, Param1Type, Param1Name, Param2Type, Param2Name, Param3Type, Param3Name)
Definition DelegateCombinations.h:71
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(DelegateName, Param1Type, Param1Name)
Definition DelegateCombinations.h:53
EMovementMode
Definition EngineTypes.h:1007
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
@ Restart
Definition PrecomputedVolumetricLightmapStreaming.cpp:25
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Actor.h:257
Definition Character.h:242
T * GetCharacterMovement() const
Definition Character.h:397
float GetReplayLastTransformUpdateTimeStamp() const
Definition Character.h:499
static ENGINE_API FName CapsuleComponentName
Definition Character.h:410
virtual UPrimitiveComponent * GetMovementBase() const override final
Definition Character.h:686
UCharacterMovementComponent * GetCharacterMovement() const
Definition Character.h:401
const FBasedMovementInfo & GetBasedMovement() const
Definition Character.h:502
static ENGINE_API FName MeshComponentName
Definition Character.h:393
bool GetProxyIsJumpForceApplied() const
Definition Character.h:733
static ENGINE_API FName CharacterMovementComponentName
Definition Character.h:404
const FBasedMovementInfo & GetReplicatedBasedMovement() const
Definition Character.h:505
uint8 GetReplicatedMovementMode() const
Definition Character.h:511
class UCapsuleComponent * GetCapsuleComponent() const
Definition Character.h:407
virtual FQuat GetBaseRotationOffset() const
Definition Character.h:518
Definition Controller.h:41
Definition CoreNet.h:578
Definition DisplayDebugHelpers.h:9
Definition NameTypes.h:617
Definition UObjectGlobals.h:1292
static COREUOBJECT_API FObjectInitializer & Get()
Definition UObjectGlobals.cpp:5001
Definition CoreNet.h:570
Definition Array.h:670
Definition SubclassOf.h:30
Definition ActorComponent.h:152
Definition AnimSequenceBase.h:37
Definition Canvas.h:159
Definition CharacterMovementComponent.h:136
Definition InputComponent.h:729
Definition PawnMovementComponent.h:43
Definition Character.h:41
ENGINE_API int32 EnableCharacterAccelerationReplication
Definition Character.cpp:40
@ NullAllowed
Definition Object.h:62
Definition Character.h:133
ENGINE_API bool IsSimulatedBase(const UPrimitiveComponent *MovementBase)
Definition Character.cpp:563
ENGINE_API bool IsDynamicBase(const UPrimitiveComponent *MovementBase)
Definition Character.cpp:558
bool UseRelativeLocation(const UPrimitiveComponent *MovementBase)
Definition Character.h:141
@ false
Definition radaudio_common.h:23
Definition AnimMontage.h:335
Definition Character.h:177
bool HasRelativeRotation() const
Definition Character.h:219
bool IsBaseUnresolved() const
Definition Character.h:225
Definition CharacterMovementComponentAsync.h:304
Definition CharacterMovementComponentAsync.h:113
Definition CharacterMovementReplication.h:370
Definition CharacterMovementReplication.h:233
Definition DamageEvents.h:16
Definition HitResult.h:21
Definition Character.h:48
bool HasRootMotion() const
Definition Character.h:108
Definition AnimationAsset.h:711
Definition RootMotionSource.h:753
ENGINE_API void Clear()
Definition RootMotionSource.cpp:2170
Definition Character.h:118
Definition EngineBaseTypes.h:173
Definition NetSerialization.h:500
Definition NetSerialization.h:455
Definition NetSerialization.h:541
Definition ObjectPtr.h:488