Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------- Pawn H
- #pragma once
- #include "Components/CapsuleComponent.h"
- #include "GameFramework/Pawn.h"
- #include "CustomMoveComp.h"
- #include "CustomPawn.generated.h"
- UCLASS(BlueprintType, Blueprintable)
- class ACustomPawn : public APawn
- {
- GENERATED_BODY()
- private:
- UPROPERTY(Category = Character, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
- class UCapsuleComponent* CapsuleComponent;
- UPROPERTY(Category = Character, VisibleAnywhere, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
- class UCustomMoveComp* CustomMovement;
- public:
- ACustomPawn();
- };
- //------------- Pawn CPP
- #include "CustomPawn.h"
- ACustomPawn::ACustomPawn()
- {
- CapsuleComponent = CreateDefaultSubobject<UCapsuleComponent>(TEXT("Capsule"));
- SetRootComponent(CapsuleComponent);
- CustomMovement = CreateDefaultSubobject<UCustomMoveComp>(TEXT("MovementComponent"));
- CustomMovement->SetUpdatedComponent(CapsuleComponent);
- }
- //---------- Comp H
- #pragma once
- #include "GameFramework/PawnMovementComponent.h"
- #include "CustomMoveComp.generated.h"
- UCLASS(BlueprintType, Blueprintable)
- class UCustomMoveComp : public UPawnMovementComponent
- {
- GENERATED_BODY()
- public:
- UCustomMoveComp();
- virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
- };
- //------------ Comp CPP
- #include "CustomMoveComp.h"
- UCustomMoveComp::UCustomMoveComp()
- {
- }
- void UCustomMoveComp::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
- {
- Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
- UE_LOG(LogTemp, Warning, TEXT("Ticking Custom Move"));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement