I just started a first person project and tried making the projectiles spawn on server so all clients could see but when they are spawned on the server the spawn location is not correct
C++ Server Function
.h
I tried reliable and unreliable but both had the same problem
UFUNCTION(Server, Unreliable, WithValidation)
void CreateProjectile(FRotator SpawnRotation, FVector SpawnLocation);
.cpp
void AFirstPersonCharacter::CreateProjectile_Implementation(FRotator SpawnRotation,FVector SpawnLocation)
{
UWorld* const World = GetWorld();
if (World != NULL)
{
// spawn the projectile at the muzzle
World->SpawnActor<ASurvivalProjectile>(ProjectileClass, SpawnLocation, SpawnRotation);
}
}
When I spawn it on client its comes out of the end of the gun
Spawning on Client:
When I spawn it on server its way further then the end of the gun
Spawning on server with the function above: