Rotation start

This commit is contained in:
2025-07-20 01:15:34 -04:00
parent 6a57c74661
commit aee1f481cb
6 changed files with 15 additions and 9 deletions

View File

@@ -51,8 +51,8 @@ private:
USceneComponent* ProjectileSpawnPoint;
//test uprops showing all that you can do with them
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Super Duper Variables", meta = (AllowPrivateAccess = "true"))
float Speed = 400.f;
/*UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Super Duper Variables", meta = (AllowPrivateAccess = "true"))
float Speed = 400.f;*/
UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Super Duper Variables", meta = (AllowPrivateAccess = "true"))
int32 VisibleAnywhere = 12;

View File

@@ -4,6 +4,7 @@
#include "Tank.h"
#include "GameFramework/SpringArmComponent.h"
#include "Camera/CameraComponent.h"
#include "Kismet/GameplayStatics.h"
#include "Components/InputComponent.h"
ATank::ATank()
@@ -32,8 +33,9 @@ void ATank::Move(float Value)
{
//FVector DeltaLocation(0.f); //Same as line below
FVector DeltaLocation = FVector::ZeroVector;
DeltaLocation.X = Value;
AddActorLocalOffset(DeltaLocation);
// X = Value * DeltaTime * Speed
DeltaLocation.X = Value * Speed * UGameplayStatics::GetWorldDeltaSeconds(this);
AddActorLocalOffset(DeltaLocation, true);
//UE_LOG(LogTemp, Warning, TEXT("Value: %f"), Value);
}

View File

@@ -27,6 +27,10 @@ private:
UPROPERTY(VisibleAnywhere, Category = "Components")
class UCameraComponent* Camera;
void Move(float Value);
UPROPERTY(EditAnywhere, Category = "Movement")
float Speed = 200.f;
void Move(float Value);
void Turn(float TValue);
};