yes there attached to a arrow component coming out of the gun…
void AWeaponBase::OnShoot_Implementation(UWorld* world, APawn* gunOwner, float attackPower)
{
AActor* weapon = SpawnBullitBP<AActor>(GetWorld(), BPBullit, ProjectileSpawnPoint->GetComponentLocation()/*+ (ProjectileSpawnPoint->GetForwardVector() * 100)*/, ProjectileSpawnPoint->GetComponentRotation());
AAmmoBase* projectile = Cast<AAmmoBase>(weapon);
if (projectile != NULL)
{
FVector const LaunchDir = ProjectileSpawnPoint->GetForwardVector() * 100;
// place it at the barrel of the gun
projectile->AttachToComponent(ProjectileSpawnPoint, FAttachmentTransformRules::SnapToTargetIncludingScale, "");
projectile->InitStats(_AttackRange, _Damage);
projectile->InitVelocity(LaunchDir);
}
}
void AAmmoBase::InitVelocity(const FVector & ShootDirection)
{
if (ProjectileMovement)
{
// set the projectile's velocity to the desired direction
ProjectileMovement->Velocity = ShootDirection * ProjectileMovement->InitialSpeed;
}
}