Minor - Ajustement sur la balle
Le sprite devrait apparaitre et se déplacer avec tout l'objet + la balle.
This commit is contained in:
@@ -3,8 +3,6 @@
|
|||||||
#include "M4_Gamemode.h"
|
#include "M4_Gamemode.h"
|
||||||
#include "M4_Projectile.h"
|
#include "M4_Projectile.h"
|
||||||
#include "GameFramework/PlayerController.h"
|
#include "GameFramework/PlayerController.h"
|
||||||
#include "Kismet/KismetMathLibrary.h"
|
|
||||||
#include "Camera/CameraComponent.h"
|
|
||||||
|
|
||||||
AM4_PlayerPawn::AM4_PlayerPawn()
|
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);
|
AM4_Projectile* Projectile = World->SpawnActor<AM4_Projectile>(Proj, InitialLocation, InitialRotation, SpawnParams);
|
||||||
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, TEXT("Spell Casted!"));
|
GEngine->AddOnScreenDebugMessage(-1, 5.0f, FColor::Green, TEXT("Spell Casted!"));
|
||||||
//FVector LaunchDirection = FVector(InitialLocation);
|
|
||||||
/*if (Projectile)
|
|
||||||
{
|
|
||||||
Projectile->ShootDirection(LaunchDirection);
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
#include "M4_Projectile.h"
|
#include "M4_Projectile.h"
|
||||||
#include "GameFramework/ProjectileMovementComponent.h"
|
|
||||||
#include "Components/MeshComponent.h"
|
#include "Components/MeshComponent.h"
|
||||||
|
#include "M4_Gamemode.h"
|
||||||
|
|
||||||
// Sets default values
|
// Sets default values
|
||||||
AM4_Projectile::AM4_Projectile()
|
AM4_Projectile::AM4_Projectile()
|
||||||
{
|
{
|
||||||
|
|
||||||
PrimaryActorTick.bCanEverTick = true;
|
PrimaryActorTick.bCanEverTick = true;
|
||||||
|
|
||||||
if(!RootComponent)
|
if(!RootComponent)
|
||||||
@@ -49,27 +47,21 @@ 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()
|
void AM4_Projectile::BeginPlay()
|
||||||
{
|
{
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
InitialLoc = GetActorLocation();
|
InitialLoc = GetActorLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AM4_Projectile::OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,FVector Impulse, const FHitResult& Hit)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Called every frame
|
// Called every frame
|
||||||
void AM4_Projectile::Tick( float DeltaTime )
|
void AM4_Projectile::Tick( float DeltaTime )
|
||||||
{
|
{
|
||||||
Super::Tick( 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);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,4 @@
|
|||||||
#include "GameFramework/ProjectileMovementComponent.h"
|
#pragma once
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "CoreMinimal.h"
|
#include "CoreMinimal.h"
|
||||||
#include "GameFramework/Actor.h"
|
#include "GameFramework/Actor.h"
|
||||||
@@ -33,7 +31,5 @@ public:
|
|||||||
UPROPERTY(VisibleDefaultsOnly, Category = Projectile)
|
UPROPERTY(VisibleDefaultsOnly, Category = Projectile)
|
||||||
UMaterialInstanceDynamic* ProjectileMat;
|
UMaterialInstanceDynamic* ProjectileMat;
|
||||||
|
|
||||||
void ShootDirection(const FVector& ShootDir);
|
|
||||||
void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,FVector Impulse, const FHitResult& Hit);
|
void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp,FVector Impulse, const FHitResult& Hit);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user