Announcement

Collapse
No announcement yet.

Move SkeletalMesh Component

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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:

    Code:
    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: https://www.dropbox.com/s/a3qjahe0xe...esh1P.png?dl=0

    Any suggestions?
Working...
X