Custom CharacterMovementComponent and ClientFillNetworkMoveData problem

Hi,

I’m making a custom CharacterMovementComponent and so I created a FCustomSavedMove_Character (inheriting from FSavedMove_Character) and also a FCustomNetworkMoveData (inheriting from FNetworkMoveData).

I have a custom parameter that I want to replicate to server so I have to override the ClientFillNetworkMoveData :slight_smile:

void FCustomNetworkMoveData::ClientFillNetworkMoveData(const FSavedMove_Character& ClientMove, ENetworkMoveType MoveType)
{
	FCharacterNetworkMoveData::ClientFillNetworkMoveData(ClientMove, MoveType);	
	//-- Here is my problem !
}

So the problem is that I have to get my custom parameter from the savedmove and I have to cast the FSavedMove_Character& ClientMove → FCustomSavedMove_Character to be able to access to my parameter.

But, whatever I tested (Cast, const_cast, dynamic_cast, static_cast) nothing works. Does someone have a clue on how to Cast my FSavedMove_Character into FCustomSavedMove_Character here ?

Thank you,

Static cast should work, just don’t cast away the const-ness.

const auto& CustomClientMove = static_cast<const FCustomSavedMove_Character&>(ClientMove);

Yes, it works ! Thank you !

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

1 Like