Download

Help with FPS C++ tutorial

I am a beginner with C++ and Blueprint and am in the middle of following this tutorial (this link will take you to the part I’m at): https://wiki.unrealengine.com/First_Person_Shooter_C%2B%2B_Tutorial#Adding_a_First_Person_Mesh

I ran into a problem at the first person mesh part. Probably something I did wrong, but I can’t figure out what.

I added the arms:

And the code:

But when I jump in and play it is clear that the arms are not parented to the FirstPersonCameraComponent, as expected from:


 FirstPersonMesh->AttachParent = FirstPersonCameraComponent;

Any idea what I’m doing wrong?

Hi Crafty,

When you pressed Play, did your arms look something like this? If so, you were doing it correctly. That step of the tutorial gets the first person mesh attached and visible, you will fine tune its positioning later on in the tutorial. If you look at the Components tab in your first screenshot, you will notice that the FirstPersonMesh is below, and slightly indented from the FirstPersonCameraComponent. That means it is a child of the camera component, and after you have set its position in the Blueprint it will maintain that same relative position to the camera component when the game is being played.

Hi Tim, thanks for responding.

A video is probably the best way to describe what I mean:

As you can see it pitches and rotates with the character but doesn’t move with it.

You’re right, that is rather odd. I actually went through this same tutorial myself a few weeks ago to make sure it all worked, and I did not run into the problem that you are seeing. I compared my code to what you showed, and everything looks correct. My suggestion would be to back up a little ways in the tutorial. Take your project back to where you were at this point, and then move forward to see if the same thing happens again.

Works now. I left the C++ alone and just went over the Blueprint parts again (deleted the old ones) and that fixed it. Thanks.

edit:

End result: [video]Dropbox - Error

That looks a lot better! I’m really not sure at all what was causing the issue you were experiencing, but it usually doesn’t hurt to go back a few steps and try again whenever something doesn’t look right.