In my character, I have all of the input parts setup correctly, and the capsule component is moving, but the camera isn’t moving with it. I did put Cam->AttachParent Capsule Component, is there anything else I need to do? Tell me if there is anything else that I need to show you.
Here is the important part of my constructor:
// init capsule size
CapsuleComponent->InitCapsuleSize(42.f, 96.f);
// initialize the camera
Cam = PCIP.CreateDefaultSubobject<UCameraComponent>(this, TEXT("Cam"));
Cam->AttachParent = CapsuleComponent;
Cam->RelativeLocation = FVector(0, 0, 64.f); // Position the camera
// initialize the weapon
Weap = PCIP.CreateDefaultSubobject<UFPSWeapon>(this, TEXT("Weap"));
// attach the weapon to the camera
Weap->AttachParent = Cam;
Looking at your code I don’t see anything obviously wrong.
When you make a blueprint from this actor what does the structure look like in the COMPONENT tab of the blueprint?
It should look something like this
If it does not have something like this which I would think Mesh1P would be replaced with your “Weap” then there might be something off.
What class are you basing yours off of?
What template did you use to start your project?
It could be needing a rootcomponent set if you don’t have one like the picture shows also make sure you have character movement. Can I see your gamemode settings also?
Components don’t exactly match that :
because you left out the camera in your example. This game mode extends the default gamemode so nothing special. There is nothing in the graph section.
This might help explain exactly my problem:
I apologize for the bad writing
is the weap mesh/model your own?
Just guessing here but if it is then it could be perhaps that your relative world location isn’t right so when you import it the location isnt right which I think could cause it to offset so far from the capsule. you could try aligning it in the component tab.
Yes the model is mine, but the camera is the default UCameraComponent. Do you think that having a custom mesh would change the point that the camera is in a different (and the mesh is attached to the camera by the way).
Additionally, my UFPSWeapon class is derived from USkeletalMeshComponent if that helps.
Thank you so much!!
I had issues before where the Origin point of my model was off so of course it offset everything else as it uses that point a HOME. so if you origin was say 100 units off then it would think that that was the HOME and attach there.
oh so they have no connection at all one moves the other NEVER moves?
Just to make sure we’re on the same page, the root is moving and falling and acting like it should, it is just not taking the camera with it. Even without the model I have this problem.
yes, there is no connection.
Still don’t know what the problem, but when I went back to an old copy of the project and added my new code, it worked fine with practically the same code.
Thanks for all of the help.