Update Character for Procedural Aiming & Character Parenting

This commit is contained in:
Philip W 2024-03-06 18:13:46 +00:00
parent e8c3a10c57
commit 1fd59390ff
26 changed files with 75 additions and 68 deletions

Binary file not shown.

Binary file not shown.

View File

@ -31,20 +31,20 @@ AEndlessVendettaCharacter::AEndlessVendettaCharacter()
// Set size for collision capsule
GetCapsuleComponent()->InitCapsuleSize(55.f, 96.0f);
// Create a CameraComponent
FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
FirstPersonCameraComponent->SetupAttachment(GetCapsuleComponent());
FirstPersonCameraComponent->SetRelativeLocation(FVector(-10.f, 0.f, 60.f)); // Position the camera
FirstPersonCameraComponent->bUsePawnControlRotation = true;
// Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
Mesh1P->SetOnlyOwnerSee(true);
Mesh1P->SetupAttachment(FirstPersonCameraComponent);
Mesh1P->bCastDynamicShadow = false;
Mesh1P->CastShadow = false;
//Mesh1P->SetRelativeRotation(FRotator(0.9f, -19.19f, 5.2f));
Mesh1P->SetRelativeLocation(FVector(-30.f, 0.f, -150.f));
// // Create a CameraComponent
// FirstPersonCameraComponent = CreateDefaultSubobject<UCameraComponent>(TEXT("FirstPersonCamera"));
// FirstPersonCameraComponent->SetupAttachment(GetCapsuleComponent());
// FirstPersonCameraComponent->SetRelativeLocation(FVector(-10.f, 0.f, 60.f)); // Position the camera
// FirstPersonCameraComponent->bUsePawnControlRotation = true;
//
// // Create a mesh component that will be used when being viewed from a '1st person' view (when controlling this pawn)
// Mesh1P = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("CharacterMesh1P"));
// Mesh1P->SetOnlyOwnerSee(true);
// Mesh1P->SetupAttachment(FirstPersonCameraComponent);
// Mesh1P->bCastDynamicShadow = false;
// Mesh1P->CastShadow = false;
// //Mesh1P->SetRelativeRotation(FRotator(0.9f, -19.19f, 5.2f));
// Mesh1P->SetRelativeLocation(FVector(-30.f, 0.f, -150.f));
}
void AEndlessVendettaCharacter::IncrementRestrictedBoundsCount()
@ -105,6 +105,7 @@ void AEndlessVendettaCharacter::BeginPlay()
GadgetManagerActor->AttachToComponent(GetRootComponent(), AttachmentRules);
for (UActorComponent* PlayersCamera : GetComponentsByTag(UCameraComponent::StaticClass(), FName("PlayersCamera")))
{
FirstPersonCameraComponent = Cast<UCameraComponent>(PlayersCamera);
GadgetManager->SpawnGadgetsOnBeginPlay(Cast<USceneComponent>(PlayersCamera));
break;
}
@ -210,16 +211,16 @@ void AEndlessVendettaCharacter::SetupPlayerInputComponent(class UInputComponent*
if (UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent))
{
//Jumping
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &ACharacter::Jump);
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
// EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &ACharacter::Jump);
// EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);
//Moving
EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Move);
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::Sprint);
EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::StopSprint);
// EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Move);
// EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::Sprint);
// EnhancedInputComponent->BindAction(SprintAction, ETriggerEvent::Completed, this, &AEndlessVendettaCharacter::StopSprint);
//Looking
EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Look);
// EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AEndlessVendettaCharacter::Look);
// Gadget Toggling
EnhancedInputComponent->BindAction(ReconAction, ETriggerEvent::Started, this, &AEndlessVendettaCharacter::ToggleRecon);

View File

@ -46,12 +46,12 @@ private:
UInputMappingContext* DefaultMappingContext;
/** Jump Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
UInputAction* JumpAction;
// UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
// UInputAction* JumpAction;
/** Move Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
UInputAction* MoveAction;
// UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
// UInputAction* MoveAction;
// Gadget Actions
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Input, meta=(AllowPrivateAccess = "true"))
@ -176,8 +176,8 @@ public:
double MoveGroundSpeed;
/** Look Input Action */
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
class UInputAction* LookAction;
// UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
// class UInputAction* LookAction;
/** Bool for AnimBP to switch to another animation set */
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Weapon)