I am using Unreal extending the Character class. I have a mesh of just arms for FPS view. It is child of the Camera Component which I created in the Character class.
For some reason the Arms mesh does not move down when the camera does. And even if I try to force it to move down in code it does not move. NOTE: If I add values in the X,Y of the vector the mesh will move along those axis fine with this code. Also the arms mesh is set to ‘moveable’.
I guess something is locking the Z location value on this component somehow, since it should really be following the location of the camera, and when that moves down when I crouch I had expected the camera location to also move down.
Here is the code where I try to move the arms mesh manually when crouch happens:
void ACopCharacter::ActionCrouch()
{
Crouch();
if(Mesh_Arms!=nullptr)
{
UE_LOG(LogTemp, Warning, TEXT("crouching"));
FVector deltaLocation=FVector(0, 0, -50);
Mesh_Arms->SetRelativeLocation(Mesh_Arms->GetRelativeLocation()+FVector(0,0,-100));
}
}
One last thing I thought might be worth mentioning is I am using a BP of this character, and in there I have manually dragged the arms mesh down. Because the rig I used to make the arms meant its origin is actually where the feet would be if the arms had a full body. So parenting it to camera meant the arms were way too high. So as I say, I dragged it manually down in BP Editor.
If anyone knows what this could be I would be very grateful. Thanks in advance.