73 - Projectile Movement Component

This commit is contained in:
Kingsmedia 2022-05-05 12:59:50 +02:00
parent e56044608a
commit a3cc71b200
3 changed files with 7 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "Projectile.h"
#include "Components/BoxComponent.h"
#include "GameFramework/ProjectileMovementComponent.h"
AProjectile::AProjectile()
{
@ -16,6 +17,9 @@ AProjectile::AProjectile()
CollisionBox->SetCollisionResponseToChannels(ECollisionResponse::ECR_Ignore);
CollisionBox->SetCollisionResponseToChannel(ECollisionChannel::ECC_Visibility, ECollisionResponse::ECR_Block);
CollisionBox->SetCollisionResponseToChannel(ECollisionChannel::ECC_WorldStatic, ECollisionResponse::ECR_Block);
ProjectileMovementComponent = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("ProjectileMovementComponent"));
ProjectileMovementComponent->bRotationFollowsVelocity = true;
}
void AProjectile::BeginPlay()

View File

@ -22,4 +22,7 @@ public:
UPROPERTY(EditAnywhere)
class UBoxComponent* CollisionBox;
UPROPERTY(VisibleAnywhere)
class UProjectileMovementComponent* ProjectileMovementComponent;
};