my character moves forward and backward perfectly but not right or left. there is no error showing so I’m having a hard time figuring it out.
// Fill out your copyright notice on the Description page of Project Settings.
#include "VRCharacter.h"
#include "Camera/CameraComponent.h"
// Sets default values
AVRCharacter::AVRCharacter()
{
// 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;
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
Camera->SetupAttachment(GetRootComponent());
}
// Called when the game starts or when spawned
void AVRCharacter::BeginPlay()
{
Super::BeginPlay();
bUseControllerRotationPitch = true;
}
// Called every frame
void AVRCharacter::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void AVRCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis(TEXT("Forward"), this, &AVRCharacter::MoveForward);
PlayerInputComponent->BindAxis(TEXT("Forward"), this, &AVRCharacter::MoveRight);
PlayerInputComponent->BindAxis("Turn", this, &AVRCharacter::AddControllerYawInput);
PlayerInputComponent->BindAxis("LookUp", this, &AVRCharacter::AddControllerPitchInput);
}
void AVRCharacter::MoveForward(float throttle)
{
AddMovementInput(throttle*Camera->GetForwardVector());
}
void AVRCharacter::MoveRight(float throttle)
{
AddMovementInput(throttle*Camera->GetRightVector());
}
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "VRCharacter.generated.h"
UCLASS()
class ARCHITECTUREEXPLORER_API AVRCharacter : public ACharacter
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
AVRCharacter();
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:
UPROPERTY(VisibleAnyWhere)
class UCameraComponent*Camera;
class UScenceComponent*VRRoot;
private:
void MoveForward(float throttle);
void MoveRight(float throttle);
};
here is my full code and i also trying to give mouse input cause every time I update something i have to put VR Head Set, it’s kinda annoying me.