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

@@ -87,10 +87,10 @@ DefaultViewportMouseLockMode=LockOnCapture
FOVScale=0.011110 FOVScale=0.011110
DoubleClickTime=0.200000 DoubleClickTime=0.200000
+ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton) +ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
+AxisMappings=(AxisName="MoveForward",Scale=4.000000,Key=W) +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W)
+AxisMappings=(AxisName="MoveForward",Scale=-4.000000,Key=S) +AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S)
+AxisMappings=(AxisName="Turn",Scale=4.000000,Key=D) +AxisMappings=(AxisName="Turn",Scale=1.000000,Key=D)
+AxisMappings=(AxisName="Turn",Scale=-4.000000,Key=A) +AxisMappings=(AxisName="Turn",Scale=-1.000000,Key=A)
+AxisMappings=(AxisName="RotateTurret",Scale=1.000000,Key=MouseX) +AxisMappings=(AxisName="RotateTurret",Scale=1.000000,Key=MouseX)
DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput DefaultPlayerInputClass=/Script/EnhancedInput.EnhancedPlayerInput
DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent DefaultInputComponentClass=/Script/EnhancedInput.EnhancedInputComponent

Binary file not shown.

View File

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

View File

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

View File

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