How would I arrange my movement code?

Hello

I am new to the development with the unreal engine. I want to make a relativ simple game and I wanted to start up with the camera movement settings. In the middle of the game there is a “interactiv building” and I want to move around this building with the camera. The “A”-button moves the camera to the left, in a circle-motion around this building and the “D”-button moves it to the right.

This documentation here https://docs.unrealengine.com/latest/INT/Programming/Gameplay/Framework/Input/index.html is quite helpful, but it doesn’t tell me how to arrange my code. Where do I should put it into and how do I make it accessible?

When I look at the TowerDefense-GameExample, the code seems pretty scatered.

How would you start?

It would be nice if you can help me out with this little task. :slight_smile:

Ok, lets make it simpler.

I have added a Character.cpp/h, but I get no output on my screen.

What part am I missing?

#include "TowerBrick.h"
#include "TowerCharacter.h"


ATowerCharacter::ATowerCharacter(const class FPostConstructInitializeProperties& PCIP)
	: Super(PCIP)
{

}

void ATowerCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
	check(InputComponent);
	InputComponent->BindAxis("CameraMoveSideway", this, &ATowerCharacter::MoveCamera);
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("Test1"));
}

void ATowerCharacter::MoveCamera(float Value)
{
	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Blue, TEXT("Test2"));
	
	if (Controller && Value != 0.f)
	{
		//Stuff
	}
}

I can’t find the cause of the problem. Even if I move it into the PlayerController I still get no working result.

It’s quite frustrating and I realy want it to get working.

There must be something I’m missing…

Sorry, I don’t want to spam.

I have tried to do it with the BluePrint version of the docu and even the inputevent doesn’t react. (It’s a new C++ (blank) project.)

MyPlayerController and MyCharacter are empty after the constructor.

Here is my DefaultInput.ini if it helps:

[/Script/Engine.InputSettings]
-AxisConfig=(AxisKeyName=“Gamepad_LeftX”,AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName=“Gamepad_LeftY”,AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName=“Gamepad_RightX”,AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName=“Gamepad_RightY”,AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f))
-AxisConfig=(AxisKeyName=“MouseX”,AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
-AxisConfig=(AxisKeyName=“MouseY”,AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f))
+AxisConfig=(AxisKeyName=“Gamepad_LeftX”,AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName=“Gamepad_LeftY”,AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName=“Gamepad_RightX”,AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName=“Gamepad_RightY”,AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName=“MouseX”,AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
+AxisConfig=(AxisKeyName=“MouseY”,AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False))
bUseMouseForTouch=False
+AxisMappings=(AxisName=“CameraMovesideway”,Key=A,Scale=1.000000)
+AxisMappings=(AxisName=“CameraMovesideway”,Key=Gesture_SwipeLeftRight,Scale=1.000000)
+AxisMappings=(AxisName=“CameraMovesideway”,Key=D,Scale=-1.000000)
+AxisMappings=(AxisName=“CameraMovesideway”,Key=H,Scale=1.000000)
DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks
DefaultTouchInterface=None