Guten Abend,
ich bin gerade dabei mich in die Unreal Engine einzufuchsen.
Als kleines Projekt möchte ich einen Würfel "Würfeln" lassen! (am Ende soll es sowas wie yahtzee sein). Das ganze Programmiere ich mittels C++.
Bis jetzt habe ich einen Pawn erstellt, der mittels WASD bewegt werden kann. Nun wäre mein nächster Schritt das "würfeln" zu simulieren jedoch bin ich mir nicht so ganz sicher wie man dies am Besten realisieren kann! ich hatte mir das so gedacht das ich in meinen Würfel auf einen Mausklick reagieren lasse, also sprich immer wenn man Klickt soll gewürfelt werden.
Gibt es unter C++ einen Code bzw. eine Möglichkeit dieses zu implementieren? reicht ein Pawn hier aus oder sollte man lieber einen Character nehmen ? vielleicht hat jemand sowas ähnliches schon mal gemacht und kann mir hier etwas unter die Arme greifen
Danke euch schon mal!!
mein code sieht bis jetzt so aus:
// Fill out your copyright notice in the Description page of Project Settings.
#include "Pawnactor.h"
#include "Camera/CameraComponent.h"
#include "GameFramework/FloatingPawnMovement.h"
#include "GameFramework/Pawn.h"
#include "Components/InputComponent.h"
// Sets default values
APawnactor::APawnactor()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
CreateDefaultSubobject<UFloatingPawnMovement>("PawnMovement");
CubeMesh = CreateDefaultSubobject<UStaticMeshComponent>("CubeMesh");
Camera = CreateDefaultSubobject<UCameraComponent>("Camera");
}
// Called when the game starts or when spawned
void APawnactor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void APawnactor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
// Called to bind functionality to input
void APawnactor::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
Super::SetupPlayerInputComponent(PlayerInputComponent);
PlayerInputComponent->BindAxis("MoveForward", this, &APawnactor::MoveForward);
PlayerInputComponent->BindAxis("MoveRight", this, &APawnactor::MoveRight);
}
void APawnactor::MoveForward(float Value)
{
AddMovementInput(GetActorForwardVector(), Value);
}
void APawnactor::MoveRight(float Value)
{
AddMovementInput(GetActorRightVector(), Value);
}
Alles anzeigen