Minor - Ajustement sur la balle

Le sprite devrait apparaitre et se déplacer avec tout l'objet + la balle.
This commit is contained in:
NisemonoQ
2025-10-31 17:54:49 +01:00
parent 7a9a6d257a
commit 9ddc2fdbed
3 changed files with 9 additions and 29 deletions

View File

@@ -3,8 +3,6 @@
#include "M4_Gamemode.h"
#include "M4_Projectile.h"
#include "GameFramework/PlayerController.h"
#include "Kismet/KismetMathLibrary.h"
#include "Camera/CameraComponent.h"
AM4_PlayerPawn::AM4_PlayerPawn()
{
@@ -98,12 +96,6 @@ void AM4_PlayerPawn::Shoot(const FInputActionInstance& Inst)
AM4_Projectile* Projectile = World->SpawnActor<AM4_Projectile>(Proj, InitialLocation, InitialRotation, SpawnParams);
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, TEXT("Spell Casted!"));
//FVector LaunchDirection = FVector(InitialLocation);
/*if (Projectile)
{
Projectile->ShootDirection(LaunchDirection);
}*/
}
}
};

View File

@@ -1,12 +1,10 @@
#include "M4_Projectile.h"
#include "GameFramework/ProjectileMovementComponent.h"
#include "Components/MeshComponent.h"
#include "M4_Gamemode.h"
// Sets default values
AM4_Projectile::AM4_Projectile()
{
PrimaryActorTick.bCanEverTick = true;
if(!RootComponent)
@@ -49,17 +47,6 @@ AM4_Projectile::AM4_Projectile()
}
}
/*void AM4_Projectile::ShootDirection(const FVector& ShootDir)
{
FVector Dir = -1.f *(ShootDir * Speed);
}*/
void AM4_Projectile::OnHit(
* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,FVector Impulse, const FHitResult& Hit)
{
}
void AM4_Projectile::BeginPlay()
{
@@ -67,9 +54,14 @@ void AM4_Projectile::BeginPlay()
InitialLoc = GetActorLocation();
}
void AM4_Projectile::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,FVector Impulse, const FHitResult& Hit)
{
}
// Called every frame
void AM4_Projectile::Tick( float DeltaTime )
{
Super::Tick( DeltaTime);
//NewLoc = GetActorLocation() + FVector(0.f, InitialLoc.Y * Speed * DeltaTime, InitialLoc.Z * Speed * DeltaTime);
NewLoc = InitialLoc + FVector(InitialLoc.X * Speed * DeltaTime, InitialLoc.Y * Speed * DeltaTime, InitialLoc.Z * Speed * DeltaTime);
}

View File

@@ -1,6 +1,4 @@
#include "GameFramework/ProjectileMovementComponent.h"
#pragma once
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
@@ -33,7 +31,5 @@ public:
UPROPERTY(VisibleDefaultsOnly, Category = Projectile)
UMaterialInstanceDynamic* ProjectileMat;
void ShootDirection(const FVector& ShootDir);
void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,FVector Impulse, const FHitResult& Hit);
};