Skeletal Mesh Socket Rotation and Location

Hi. I am trying to do a weapon and projectile programming. But I am getting a weird Skeletal Mesh Socket location and rotation.

It seems the location of the socket doesn’t include my character’s or attached weapon’s rotation. But rotation and location seems to include animation (In the picture below the red line animating with the characters idle animation but it always directing the same direction it is not including my character’s rotation but it includes my character’s location.).

Here is the results:

Here is my draw debug line code on Weapon Actor class. Note: SkeletalMesh of Weapon Actor is root component and the bCanEverTick for it’s PrimaryActor also enabled.

void AFireArm::Tick(float DeltaSeconds)
{
        // ...
	DrawDebugLine(GetWorld(), SkeletalMesh->GetSocketLocation("Muzzle"), SkeletalMesh->GetSocketLocation("Muzzle") + SkeletalMesh->GetSocketRotation("Muzzle").Vector() * 5000.0F, FColor::Red);

	const USkeletalMeshSocket* socket = SkeletalMesh->GetSocketByName("Muzzle");
	if (socket)
	{
		GEngine->AddOnScreenDebugMessage(1, 1, FColor::Red, "Socket Valid");
	}
}

I have attached the weapon like this:

void APlayerCharacter::BeginPlay()
{
	FActorSpawnParameters SpawnParams;
	SpawnParams.Owner = this;
	SpawnParams.Instigator = Instigator;

	
	AFireArm* FireArm = GetWorld()->SpawnActor<AFireArm>(DefaultFireArm, SpawnParams);
	if (FireArm)
	{
		FireArm->AttachRootComponentTo(Mesh, "WeaponSocket", EAttachLocation::SnapToTarget);
		FireArms.Add(FireArm);
		CurrentFireArm = FireArm;
	}
}

Finally this is the socket for the weapon:

What is wrong with the code. Can you help me?

I’ve still need to get help. Any ideas?

Your muzzle is not pointing forward - Unreal uses +X as forward, the red axis. In some model-viewers however it still uses +Y as forward, so its not obvious.

Maybe it is a problem but not the problem I mentioned I think. Because debug line (the red line) is not affected by my characters rotation. Always points the same direction (+X for a weapon1 and +y for another weapon)

Here is a video: - YouTube