Weapon Incorrectly Rotated Mesh1P from a duplicated ShooterGame project

Alritey, new here, not new to Indie Game Development.
First to try this out I did the following:

Created a Fresh Blank Project from the launcher → ClientFps

Then copied Source / Config from ShooterGame → ClientFps

Then proceeded to Replace all instances of the following:

ShooterGame → ClientFps

Shooter → Client


Then Renamed the Source and Build files as needed
Then I generated the C++ project using the context choice for the ClientFps.uproject
This built and loaded fine at this point with just a few complaints which I cleared up.
I then proceeded to Bring in the Weapons and Player Shapes and animations only from ShooterGame
using the Migrate feature to ClientFps, this seemed to work fine. Bones showed, animations worked, etc…
(Editor viewing so far).

Now I proceeded to Duplicate all the Animation Blueprints and Supporting blueprints used by the Pawn and
the Weapons (Projectiles etc…) This all seemed to go well. At this point I proceed to manuualy duplicate
the Primary Blueprints (BotPawn PlayerPawn Weapons)
This all worked it appeared fine so I then connected the Source Pawn spawn code with the new PlayerPawn
blueprint as created and then made a TeamStart point in the Simple StarterMap. It worked amazingly except
for one thing. The Weapons are Facing Down in First person. Showing properly in 3rd when UNpossessed.

I then went in and tried to find the issue. I have been unable to find the cause of this, I even tried changing this

(Original file was ShooterWeapon.cpp → ClientWeapon.cpp)

`void AClientWeapon::AttachMeshToPawn()
if (MyPawn)
// Remove and hide both first and third person meshes

	// For locally controller players we attach both weapons and let the bOnlyOwnerSee, bOwnerNoSee flags deal with visibility.
	FName AttachPoint = MyPawn->GetWeaponAttachPoint();
	//if( MyPawn->IsLocallyControlled() == true )
		USkeletalMeshComponent* PawnMesh1p = MyPawn->GetSpecifcPawnMesh(true);
		USkeletalMeshComponent* PawnMesh3p = MyPawn->GetSpecifcPawnMesh(false);
		Mesh1P->SetHiddenInGame( false );
		Mesh3P->SetHiddenInGame( false );
		Mesh1P->AttachTo(PawnMesh1p, AttachPoint);
		Mesh3P->AttachTo(PawnMesh3p, AttachPoint);
	//	USkeletalMeshComponent* UseWeaponMesh = GetWeaponMesh();
	//	USkeletalMeshComponent* UsePawnMesh = MyPawn->GetPawnMesh();
	//	UseWeaponMesh->AttachTo(UsePawnMesh, AttachPoint);	
	//	UseWeaponMesh->SetHiddenInGame( false );


In attempt to see where the issue was coming from. All the blueprints are manually created duplicates of the
ShooterGame (Had both Projects running in the editor to make sure I got em right). This is still a learning
period for me, so any assistance would be appreciated.

Weapon (Basic Gun) shows the correct 3 bones. It is pointing a nice 90 degress down
It is actually shooting correctly from the Muzzle and heading out in the direction the cursor is aimed.
It reloads (using the animations) just in the wrong rotation.
In the Editor it is showing both 1st/3rd versions with the 3p Point up in a 90 position as the original demo.

Any Ideas?

An Addition to this, osmething else I found in trying to find where I messed up.
As I know I messed up seomwhere in learning this :slight_smile:
When Viewing the PlayerPawn, (both the original and my new duplicate)
If you hit Simulate, the Original only displays the 3P weapon mesh where as
mine has both Root (1P mesh) and the 3P mesh showing from the weapon
skeleton. The 3P properly follows the animation of TPP as does the original
but in mine the Weapon (Root mesh) is still sitting on the Green Grid arrow
90 degrees out of position.

Still not sure what happened to this conversion / migration from the ShooterGame, But I found a workaround while I dig further in:

FPP_Skeleton → WeaponPoint Rotate relative axis X by -90 now positioned
correctly. I had been looking for a way to do this in C++ when it mounted
the weapons on Equip, but still don’t know the code well enough, so this was
simplier. I did take and Check out the fbx file (exported it from shootergame)
in 3ds, but I am no artist and barely know it :slight_smile: I had found that I could rotate
it that way but still wanted to figure out why it was behaving differently.

I’m having the same problem when creating a c++ Child of ShooterWeapon in the ShooterGame project. Basically I created a duplicate of ShooterWeapon_Projectile. Also for me, I’m seeing the 3rd person mesh in first person. The issue occurs whether or not I use my own gun mesh or the ones with the demo.

Same problem. Create Copy of the existing WeapLauncher or WeapRifle has no issues. Making a new blueprint derived from ShooterWeapon_Projectile and setting up all the data identically to WeapLauncher, breaks the pitch rotation of the weapon in first person.

I finally had to do the same as the OP. Just rotated the WeaponPoint on the Player skeleton. I also made a change to the AttachMeshtoPawn function at the Attachto

		Mesh1P->AttachTo(PawnMesh1p, AttachPoint, EAttachLocation::SnapToTarget);

That made the original guns work with the new weaponpoint rotation.

Blast from the past but I figured out the issue so I thought I would share it. The issue here is that you have Mesh1P as the rootcomponent, which doesn’t allow the location or rotation to be edited, per code in FSceneComponentDetails::MakeTransformDetails(). Also you can’t add a blank object then make it the rootcomponent because Mesh1P is inherited from code. So you have to adjust the code itself to make a blank component the root component then attach the Mesh1P to it. If you’re not sure how to do so here is the code:

In ShooterWeapon.h

UPROPERTY(VisibleDefaultsOnly, Category = Mesh)
USceneComponent* SceneComponent;

In ShooterWeapon.cpp

AShooterWeapon::AShooterWeapon(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
	SceneComponent = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("Root"));
	RootComponent = SceneComponent;
	Mesh1P = ObjectInitializer.CreateDefaultSubobject<USkeletalMeshComponent>(this, TEXT("WeaponMesh1P"));
	Mesh1P->MeshComponentUpdateFlag = EMeshComponentUpdateFlag::OnlyTickPoseWhenRendered;
	Mesh1P->bReceivesDecals = false;
	Mesh1P->CastShadow = false;

You need the SetupAttachment line as well as the construction of the new SceneComponent. But yeah, do this and ouila, the transform is now editable for Mesh1P.

Thanks. You got me on the right direction.
Additionally to what you’ve suggested, I had to add the “EditDefaultsOnly” property to Mesh1P.
In ShooterWeapon.h

UPROPERTY(EditDefaultsOnly, Category=Mesh)
USkeletalMeshComponent* Mesh1P;