I am new to UE4 and have been using UE4 for 2 terms.
My project name is The Last Bat, that I want the have spacers between on the GUI and this will be the only forum I will use.
In a blank C++ project my UMG is built using Blueprints and contains modified C++ classes “GHFFGameMode.cpp”, “GHFFGameMode.h” and “GHFF.Build.cs”. (The project is not named “GHFF”.)
My pawn is built using C++ classes.
I need some online instructions or answers to know how to get the button in the single player menu “start” to use my C++ pawn as a player. (My button is not called “start”.)
[FONT=Comic Sans MS]Welcome to the forums 1999!
You should check out my various wiki tutorials to learn how to get C++ and BP to interact!
Calling C++ functions from Blueprints
Calling Blueprint-Implemented functions from C++
Calling Blueprint Native Events from C++
**Many more wikis to help you out:**
https://wiki.unrealengine.com/Category:Code
:)
Rama
I am still trying to understand your instructions, so I will let you know if problems do occur and THANKS.
“How do I set the name of the application in Android? - Mobile - Epic Developer Community Forums”
So this link douse not provide the next question I was asking, " that I want the have spacers between on the GUI" (Line 2.), when I name the project I want it to be “The Last Bat” and I under stand UE4 only wants to use ASSIC letters and numbers that is understandable. So I will fix this problem by keeping the project name as “The_Last_Bat” and work on the final naming of the project latter. My other project will be trance fired to this project.
This is to keep you up to date with the other issue I am having and I will return to this forum when I have a norther mass issue.
In the guides you have given me, I think that you want me to build the values in C++ then use blueprints to trance fir the values to Blueprints then get them to guide around the player. This is the plan I had where the C++ class gets used by the blueprint when the game starts.
So I will use all your values in the Blueprint. to run the pawn.
So I was creating a new C++ class when this error occurred.
“The name Pawn is already used by another class.”
Is there any problem using explorer to force the C++ class in?
Here is some where I looked, second anwer.
“Creating classes "bug" - C++ - Epic Developer Community Forums”
So this one of the pawn controlled players when the game is operating, you should not need to see the header file, based on what I was given by “Rama” on this forum how would I use the method given or do I use another method?
// Fill out your copyright notice in the Description page of Project Settings.
#include “The_Last_Bat.h”
#include “GHFF.h”
// Sets default values.
AGHFF::AGHFF()
{
// 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;
// Take control of the default Player. You may need to remove this because it may take control of the UMG.
// AutoPossessPlayer = EAutoReceiveInput::Player0;
// Creates our root component that is our scene component.
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("SceneComponent"));
// Create our springarm component.
SpringArm = CreateDefaultSubobject<USpringArmComponent>(TEXT("SpringArmComponent"));
// Attach the spring arm component to our root component.
SpringArm->AttachTo(RootComponent);
// Set up our spring arm direction maths.
SpringArm->SetRelativeLocationAndRotation(FVector(0.f, 0.f, 0.f), FRotator(0.f, 0.f, 0.f));
// Creates first poson effect.
SpringArm->TargetArmLength = 0.f;
// Lag the camera for a certan head movement speed.
SpringArm->bEnableCameraLag = true;
// This leaves the max speed the player can turn the bats head.
SpringArm->CameraLagSpeed = 1000.f;
// We want the camera to be compleatly independant with the head. So the player can see most directions with out turning.
SpringArm->bUsePawnControlRotation = false;
// Creates our camera component.
Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("Camera"));
// Attachers the camera component to the spring arm component.
Camera->AttachTo(SpringArm, USpringArmComponent::SocketName);
// Set up values.
CurrentPitchSpeed = 0.f;
CurrentYawSpeed = 0.f;
CurrentRollSpeed = 0.f;
CurrentForwardSpeed = 50.f;
}
// Called when the game starts or when spawned.
void AGHFF::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame.
void AGHFF::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
// Calculate change in rotation this frame.
FRotator DeltaRotation(0, 0, 0);
// Calculate change in rotation this frame.
DeltaRotation.Pitch = CurrentPitchSpeed * DeltaTime;
// Calculate change in rotation this frame.
DeltaRotation.Yaw = CurrentYawSpeed * DeltaTime;
//Calculate change in rotation this frame.
DeltaRotation.Roll = CurrentRollSpeed * DeltaTime;
// Rotate GHFF.
AddActorLocalRotation(DeltaRotation);
// Rolls our player with the camera.
FRotator NewRotation = GetActorRotation();
NewRotation.Roll += CameraInput.Z;
SetActorRotation(NewRotation);
// Handle movement inputs.
{
if (!PlayerInput.IsZero())
{
PlayerInput = PlayerInput.SafeNormal() * 100.f;
FVector NewLocation = GetActorLocation();
NewLocation += GetActorForwardVector() * PlayerInput.X * DeltaTime;
NewLocation += GetActorRightVector() * PlayerInput.Y * DeltaTime;
NewLocation += GetActorUpVector() * PlayerInput.Z * DeltaTime;
SetActorLocation(NewLocation);
}
}
}
// Called to bind functionality to input.
void AGHFF::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
Super::SetupPlayerInputComponent(InputComponent);
// Checks there is a input component.
check(InputComponent);
// Gets mouse movement for camera pitch.
InputComponent->BindAxis("CameraPitch", this, &AGHFF::PitchCamera);
// Gets mouse movement for camera yaw.
InputComponent->BindAxis("CameraYaw", this, &AGHFF::YawCamera);
// Gets the keyboard for moveing the player left and right.
InputComponent->BindAxis("MoveRight", this, &AGHFF::MoveRight);
// Gets the keyboard for moveing the player foward and hovering.
InputComponent->BindAxis("MoveFoward", this, &AGHFF::MoveFoward);
// Gets the mouse for changeing the altitude.
InputComponent->BindAxis("MoveUp", this, &AGHFF::MoveUp);
}
// Called to bind functionality to input.
void AGHFF::PitchCamera(float AxisValue)
{
CameraInput.Y = AxisValue;
}
// Called to bind functionality to input.
void AGHFF::YawCamera(float AxisValue)
{
CameraInput.X = AxisValue;
}
// Called to bind functionality to input.
void AGHFF::RollCamera(float AxisValue)
{
CameraInput.Z = AxisValue;
}
// Called to bind functionality to input.
void AGHFF::MoveUp(float AxisValue)
{
PlayerInput.X = FMath::Clamp<float>(AxisValue, 1.0f, -1.0f);
}
// Called to bind functionality to input.
void AGHFF::MoveRight(float AxisValue)
{
PlayerInput.Y = FMath::Clamp<float>(AxisValue, 1.0f, -1.0f);
}
// Called to bind functionality to input.
void AGHFF::MoveFoward(float AxisValue)
{
PlayerInput.Z = FMath::Clamp<float>(AxisValue, 1.0f, -1.0f);
}
I am still building the savers (SaveWorld) C++ class for the game link here. “https://docs.unrealengine.com/latest/INT/Gameplay/SaveGame/Code/index.html”
and for my starting player “MenuPlayerControler” is being used as a Blueprint to operate the UMG. So because “this one of the pawn controlled players when the game is operating” if I was to create a world for the first time this will need to be considered and changed over to the player selected pawn.(We can look into opening a saved world next.)
I have never thought about connecting a C++ script with a Blueprint.
Sent to me by Rama, this could be what I am looking for.
“A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums”
UFUNCTION(BlueprintNativeEvent, Category=“Game”)
APawn* SpawnDefaultPawnFor(AController* NewPlayer, class AActor* StartSpot);
What more do I need to know about this?