I’m using dedicated server in editor and auto connect. When I try to move my character using AddMovementInput
, I get the following warning :
LogProperty: Warning: Native NetSerialize StructProperty /Script/Engine.Character:ServerMoveNoBase.InAccel (ScriptStruct /Script/Engine.Vector_NetQuantize10) failed.
My character rotates down and left (not right nor up) and doesn’t move, on all clients. If I don’t use dedicated server, character’s movement work on server but not on clients.
Attacks and jump works and are replicated fine everywhere, so the problem is really movement…
Here’s my code for movement (wich is the base code) :
void ASCharacter::moveForward(const float Val)
{
if ((Controller != NULL) && (Val != 0.0f) && (canMove())
{
// find out which way is forward
FRotator Rotation = Controller->GetControlRotation();
// Limit pitch when walking or falling
if (GetCharacterMovement()->IsMovingOnGround() || GetCharacterMovement()->IsFalling())
{
Rotation.Pitch = 0.0f;
}
// add movement in that direction
const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
AddMovementInput(Direction, Val);
}
}
void ASCharacter::moveRight(const float Val)
{
if ((Controller != NULL) && (Val != 0.0f) && (canMove())
{
// find out which way is right
const FRotator Rotation = Controller->GetControlRotation();
const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::Y);
// add movement in that direction
AddMovementInput(Direction, Val);
}
}
What’s going on, why isn’t the character moving ?
Thanks !
#EDIT :
The warning problem seems to come from here :
#Character.h line 240 - 250
//////////////////////////////////////////////////////////////////////////
// Server RPCs that pass through to CharacterMovement (avoids RPC overhead for components).
// The base RPC function (eg 'ServerMove') is auto-generated for clients to trigger the call to the server function,
// eventually going to the _Implementation function (which we just pass to the CharacterMovementComponent).
//////////////////////////////////////////////////////////////////////////
/** Replicated function sent by client to server - contains client movement and view info. */
UFUNCTION(unreliable, server, WithValidation)
void ServerMove(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);
void ServerMove_Implementation(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);
bool ServerMove_Validate(float TimeStamp, FVector_NetQuantize10 InAccel, FVector_NetQuantize100 ClientLoc, uint8 CompressedMoveFlags, uint8 ClientRoll, uint32 View, UPrimitiveComponent* ClientMovementBase, FName ClientBaseBoneName, uint8 ClientMovementMode);