Add functionality to ThrowThrowable

This commit is contained in:
baz 2023-09-20 01:57:37 +01:00
parent 19d452be5c
commit d3e775758d
1 changed files with 14 additions and 6 deletions

View File

@ -596,11 +596,19 @@ void APlayerCharacter::ThrowWeaponCallback()
void APlayerCharacter::ThrowExplosiveCallback() void APlayerCharacter::ThrowExplosiveCallback()
{ {
auto throwable = ThrowThrowable(); if (ThrowableInventory.Num() > 0)
{
FVector Location;
FVector BoxExtent;
GetActorBounds(true, Location, BoxExtent, false);
FVector SpawnLocation = (BoxExtent.X * GetActorForwardVector()) * 2;
SpawnLocation += Location;
SpawnLocation += (25.0f * GetActorForwardVector());
SpawnLocation.Z += BoxExtent.Z;
// TODO: Set the collision size to the size of the static mesh in the throwable AThrowable* Throwable = GetWorld()->SpawnActor<AThrowable>(ThrowableInventory.Pop(), SpawnLocation, FRotator::ZeroRotator);
// throwable->GetSphereComponent()->SetSphereRadius(); }
} }
AThrowable* APlayerCharacter::ThrowThrowable() AThrowable* APlayerCharacter::ThrowThrowable()