I am having an issue in TankTurret.cpp on Complie as it is claiming that Rotate is an illegal qualified name, I’ve compared my Code to the GitHub commit and its exactly the same.
Unreal Engine: 4.24
Visual Studio 2019 (Latest version)
I also compared it to my TankBarrel files and the same includes are there that I needed to add previously, I have no idea whats going on and Intellisense even says its fine:
#pragma once
#include "CoreMinimal.h"
#include "Battle_Tank.h"
#include "Components/StaticMeshComponent.h"
#include "TankTurret.generated.h"
/**
*
*/
UCLASS(meta = (BlueprintSpawnableComponent), hidecategories = ("Collision"))
class BATTLE_TANK_API UTankTurret : public UStaticMeshComponent
{
GENERATED_BODY()
public:
// -1 is max downward speed, and +1 is max up movement
void UTankTurret::Rotate(float RelativeSpeed);
private:
UPROPERTY(EditAnywhere, Category = Setup)
float MaxDegreesPerSecond = 25;
};
CPP:
#include "Battle_Tank.h"
#include "TankTurret.h"
#include "Math/UnrealMathUtility.h"
void UTankTurret::Rotate(float RelativeSpeed)
{
RelativeSpeed = FMath::Clamp<float>(RelativeSpeed, -1, +1);
auto RotationChange = RelativeSpeed * MaxDegreesPerSecond * GetWorld()->DeltaTimeSeconds;
auto Rotation = RelativeRotation.Yaw + RotationChange;
SetRelativeRotation(FRotator(0, Rotation, 0));
}
Also, I am having a strange issue where the Barrel is going up and down, but only with the camera movement, but I feel like getting Rotation working will help solve this