Download

Move SkeletalMesh Component

I’m trying to move the first person skeletal mesh of ShooterGame’s PlayerPawn down/up when the player crouches/stands but I’m finding none of the functions I’ve tried to have any effect on its position:



void ACharacter::OnStartCrouch()
{
	if (CharacterMovement)
	{
		if (CanCrouch())
		{
			CharacterMovement->bWantsToCrouch = true;

                        //neither of these have any affect on the Mesh1P's position relative to the player

                        //1
			Mesh1P->MoveComponent(FVector(0.0f, 0.0f, -500.0f), FRotator(0.0f), false);

                        //2
			Mesh1P->SetRelativeLocation(FVector(0.0f, 0.0f, -500.0f));

                        //3
			FTransform relTrans = Mesh1P->GetRelativeTransform();
			relTrans.SetLocation(FVector(1.0f, 1.0f, -500.0f));
			Mesh1P->SetRelativeTransform(relTrans);
		}
	}
}


Component hierarchy for reference: Dropbox - Mesh1P.png - Simplify your life

Any suggestions?