I’m very confused as of why this script works because if I’m reversing the vector of a rotation isn’t that flipping it? The goal was to make the particle rotate on spawn based off of the rotation of the vector.Rotation() and the vector comes from a Rotation Vector which has the rotation of the camera i believe so I don’t get why this doesn’t act weirdly.
FVector Location;
FRotator Rotation;
OwnerController->GetPlayerViewPoint(Location, Rotation);
FHitResult HitResult;
FVector End = Location + Rotation.Vector() * MaxRange;
bool HasHit = GetWorld()->LineTraceSingleByChannel(
HitResult,
Location,
End,
ECC_GameTraceChannel1);
if (HasHit)
{
FVector ShotDirection = -Rotation.Vector();
UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ImpactParticle, HitResult.Location, ShotDirection.Rotation());
if(HitResult.GetActor())
{
FPointDamageEvent DamageEvent(Damage, HitResult, ShotDirection, nullptr);
HitResult.GetActor()->TakeDamage(Damage, DamageEvent, OwnerController, this);
}
}