Issues with movement in Unreal

It actually says that right here.

Hmm, I may have sent you the wrong file. I tried copying and pasting the code onto it. See if this works:

https://drive.google.com/file/d/1DZ6nY_68FonIO0gSGBp38O87COQARMKY/view?usp=sharing

Still empty.

Hmm, I’m not sure why it’s doing that. I’m sure I’m sending the right file. I’ve tried it in Dropbox instead. Don’t know if that’ll make a difference.

Still empty

You can download it and see for yourself. You’ve been working on the ShooterAssetPack project.

I see what you mean. Shall I package and send you the ShooterAssetPack project instead?

Yes.

Hello

So, when I was trying to package the other file to send to you, I accidentally deleted it, tried to get it back but was struggling so I decided to retrace my steps by restarting the project to see if it would work and it did. I am able to move and jump. I’m not sure why it wasn’t doing that before, although it could be that I was using the wrong file but it is working now. Thanks for all your help on that too, by the way.

I have run into another issue though. My Shooter Character doesn’t move with the camera and I’m not sure why. Any suggestions?

Also, the level that came with the project looks a little different compared to the video, not sure if that matters? (For example: the little passage in the video is nowhere to be seen in the level I got)

ShooteerCharacter.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "ShooterCharacter.generated.h"

UCLASS()
class SIMPLESHOOTER_API AShooterCharacter : public ACharacter
{
	GENERATED_BODY()

public:
	// Sets default values for this character's properties
	AShooterCharacter();

protected:
	// Called when the game starts or when spawned
	virtual void BeginPlay() override;

public:
	// Called every frame
	virtual void Tick(float DeltaTime) override;

	// Called to bind functionality to input
	virtual void SetupPlayerInputComponent(class UInputComponent *PlayerInputComponent) override;

private:
	void MoveForward(float AxisValue);
	void MoveRight(float AxisValue);
	void LookUpRate(float AxisValue);
	void LookRightRate(float AxisValue);

	UPROPERTY(EditAnywhere)
	float RotationRate = 10;
};

ShooterCharacter.cpp

// Fill out your copyright notice in the Description page of Project Settings.

#include "ShooterCharacter.h"

// Sets default values
AShooterCharacter::AShooterCharacter()
{
	// Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;
}

// Called when the game starts or when spawned
void AShooterCharacter::BeginPlay()
{
	Super::BeginPlay();
}

// Called every frame
void AShooterCharacter::Tick(float DeltaTime)
{
	Super::Tick(DeltaTime);
}

// Called to bind functionality to input
void AShooterCharacter::SetupPlayerInputComponent(UInputComponent *PlayerInputComponent)
{
	Super::SetupPlayerInputComponent(PlayerInputComponent);

	PlayerInputComponent->BindAxis(TEXT("MoveForward"), this, &AShooterCharacter::MoveForward);
	PlayerInputComponent->BindAxis(TEXT("LookUp"), this, &APawn::AddControllerPitchInput);
	PlayerInputComponent->BindAxis(TEXT("MoveRight"), this, &AShooterCharacter::MoveRight);
	PlayerInputComponent->BindAxis(TEXT("LookRight"), this, &APawn::AddControllerYawInput);
	PlayerInputComponent->BindAxis(TEXT("LookUpRate"), this, &AShooterCharacter::LookUpRate);
	PlayerInputComponent->BindAxis(TEXT("LookRightRate"), this, &AShooterCharacter::LookRightRate);
	PlayerInputComponent->BindAction(TEXT("Jump"), EInputEvent::IE_Pressed, this, &ACharacter::Jump);
}

void AShooterCharacter::MoveForward(float AxisValue)
{
	AddMovementInput(GetActorForwardVector() * AxisValue);
}

void AShooterCharacter::MoveRight(float AxisValue)
{
	AddMovementInput(GetActorRightVector() * AxisValue);
}

void AShooterCharacter::LookUpRate(float AxisValue)
{
	AddControllerPitchInput(AxisValue * RotationRate * GetWorld()->GetDeltaSeconds());
}

void AShooterCharacter::LookRightRate(float AxisValue)
{
	AddControllerYawInput(AxisValue * RotationRate * GetWorld()->GetDeltaSeconds());
}

// void AShooterCharacter::LookUp(float AxisValue)
// {
// 	AddControllerPitchInput(AxisValue);
// }








Your character doesn’t have a camera.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms