Why UGameplayStatics::PlayWorldCameraShake() vs ClientStartCameraShake()

For the camera shake, Stephen called
GetWorld()->GetFirstPlayerController()->ClientStartCameraShake(HitCameraShakeClass);
I’m just curious why he chose that method over
UGameplayStatics::PlayWorldCameraShake(...args);

The particles and sounds are all using UGameplayStatics methods. Why the change?

		UGameplayStatics::ApplyDamage(OtherActor, Damage, MyOwnerInstigator, this, DamageeTypeClass);
		if (HitParticles)
		{
			UGameplayStatics::SpawnEmitterAtLocation(this, HitParticles, GetActorLocation(), GetActorRotation());
		}
		if (HitSound)
		{
			UGameplayStatics::PlaySoundAtLocation(this, HitSound, GetActorLocation());
		}
		if (HitCameraShakeClass)
		{
// This is the line in question
			UGameplayStatics::PlayWorldCameraShake(this, HitCameraShakeClass, GetActorLocation(), 0.f, 5000.f);
			// GetWorld()->GetFirstPlayerController()->ClientStartCameraShake(HitCameraShakeClass);
		}

I don’t think there was a particular reason for the choice. Personally I prefer the non-UGamplayStatics version for when doing so is just as trivial as it’s less cumbersome; I’d only use UGameplayStatics if it’s actually a convenience to use it instead.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms