I am using default CharacterMovementComponent with a custom Character class(Overrode only Tick, SetupPlayerInputComponent and EndPlay functions)
That’s how the crouching is handled.
void ACCharacter::BeginCrouch()
{
if (!bDied)
{
Crouch();
}
}
void ACCharacter::EndCrouch()
{
if (!bDied)
{
UnCrouch();
}
}
LineTrace happen on mouse click
MyOwner = GetOwner();
FVector EyeLocation;
FRotator EyeRotation;
// Trace the world, from pawn eyes to crosshair location
MyOwner->GetActorEyesViewPoint(EyeLocation, EyeRotation);
FVector LookDirection = EyeRotation.Vector();
FVector TraceEnd = EyeLocation + (LookDirection * Range);
FCollisionQueryParams QueryParams;
QueryParams.AddIgnoredActor(MyOwner);
QueryParams.AddIgnoredActor(this);
QueryParams.bTraceComplex = true;
QueryParams.bReturnPhysicalMaterial = true;
// Particle target parameter
FVector TracerEndPoint = TraceEnd;
EPhysicalSurface SurfaceType = SurfaceType_Default;
if (GetWorld()->LineTraceSingleByChannel(Hit, EyeLocation, TraceEnd, ECC_Camera, QueryParams))
{
DrawDebugLine(GetWorld(), EyeLocation, TraceEnd, FColor::White, false, 1.0f, 0, 1.0f);
}
This is what I expect to happen and what happens on listen server:
But this what happens if I use the same code on dedicated server:
I am really unsure what could cause the code to only not work on dedicated server.