void VehiclePawnWrapper::displayCollisionEffect(FVector hit_location, const FHitResult& hit) { if (collision_display_template != nullptr && Utils::isDefinitelyLessThan(hit.ImpactNormal.Z, 0.0f)) { UParticleSystemComponent* particles = UGameplayStatics::SpawnEmitterAtLocation(pawn_->GetWorld(), collision_display_template, hit_location); particles->SetWorldScale3D(FVector(0.1f, 0.1f, 0.1f)); } }
void UFlareAsteroidComponent::SetupEffects(bool Icy) { IsIcyAsteroid = Icy; Effects.Empty(); EffectsKernels.Empty(); AFlareAsteroid* Asteroid = Cast<AFlareAsteroid>(GetOwner()); int32 Multiplier = Asteroid ? Asteroid->EffectsMultiplier : 1; // Create random effects for (int32 Index = 0; Index < Multiplier * EffectsCount; Index++) { EffectsKernels.Add(FMath::VRand()); UParticleSystemComponent* PSC = UGameplayStatics::SpawnEmitterAttached( IceEffectTemplate, this, NAME_None, GetComponentLocation(), FRotator::ZeroRotator, EAttachLocation::KeepWorldPosition, false); PSC->SetWorldScale3D(EffectsScale * FVector(1, 1, 1)); Effects.Add(PSC); if (IsIcyAsteroid) { PSC->SetTemplate(IceEffectTemplate); } else { PSC->SetTemplate(DustEffectTemplate); } } }