Hey! I was trying to make a system which instantiates a particle at the point of rotation. I thought I could do it like this:
void ASubMachineGun::ProcessHit(const FHitResult& Hit, const FVector& Origin, const FVector& ShootDir, int32 RandomSeed, float Spread)
{
const FRotator Offset = FRotator(0, 0, 0);
const FRotator hitRotation = Hit.ImpactNormal.Rotation();
FRotator finalRotation = Offset + hitRotation;
SpawnParticle(TestPartcl, Hit.Location, finalRotation, true);
GEngine->AddOnScreenDebugMessage(-1, 2.f, FColor::Black, TEXT("Sent trace!"));
}
void AWeapon::SpawnParticle(UParticleSystem* Particle, FVector SpawnLocation, FRotator SpawnRotation, bool bAutoDestroy)
{
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), Particle, SpawnLocation, SpawnRotation, bAutoDestroy);
}
The offset would then be modified until the particle was facing “up” from the surface which it hit. However when I do this, the particle doesn’t instantiate at all. When I use “Hit.ImpactNormal.Rotation()” as my param, it instantiates but not the way that I want it to. Anybody know what might be the problem or know a different way to do this? Thank you in advance for your effort!