Child Not Receiving Parent Rotation

I’m not sure if I am missing something inside of C++ that I need to set, but I am currently attempting to have an attack that appears directly in front of the player. It spawns a collision capsule and a particle effect inside of that. When the player turns, I want the attack to rotate with the player

The problem comes during the attachment.

Every attack uses a sphere as the root component. Every attack also has a Project Movement Component that has a default speed of 0 (not every attack is a projectile). If the attack needs a different shape (cube or capsule), that UCapsuleComponent (or cube) is declared in the constructor, attached to the RootComponent, and its collision properties are set up after the fact. I do not set a relative, local, or absolute offset/rotation.

Inside of BeginPlay I have tried two things:

AttachRootComponentToActor(GetOwner(), NAME_None, EAttachLocation::SnapToTarget, true);

When I try this setup, the attack appears directly in front of the character (where I want it to appear), but it does not turn with my character. It does follow my character as my character moves, but it seems to be fixed to maintain the same relative rotation that it started with.

AttachRootComponentToActor(GetOwner(), NAME_None, EAttachLocation::KeepRelativeOffset, true);

When I try this setup, the attack appears a few hundred units behind and above the character, but it has the same problem. Its rotation does not change with the player’s rotation. Its relative offset accounts for the change in the player’s rotation, but the rotation of the actor itself does not change according to the player’s rotation.

If I do not use AttachRootComponentToActor at all, the attack spawns in the correct place, but it obviously stays still.

Is there something I’m missing about attaching actors to other actors in C++?

Thanks for your help in advance.

Hey -

You may want to take a look at the code based First Person template project and look at the defining code for the projectile. In the editor, if you set the default projectile to have a static mesh with an obvious direction (the arrows mesh in starter content is a good example) you can see that the mesh is always facing outward from the character as it rotates.

Cheers