Positioning and Rotating StaticMesh affecting the Character movement

Hi all,

I have a simple StaticMesh positioning and rotation problem that’s causing a headache…

I have a StaticMesh object that is a component on my Character. I am using this SM’s location and rotation also as a pivot position for another Static Mesh (a lantern) in the scene. At runtime I’m finding the character actor, finding this pivot’s position and rotation and then feeding these transform information into the lantern and using SetWorldLocationAndRotation to position it etc.

All is fine and when the game runs the lantern is going to the correct position and rotation.

Problem is the character is now not moving in the correct direction via it’s input. i.e. based on it’s rotation forward could be to the left etc.

 LanternSM->SetWorldLocationAndRotation(PlayerLanternPivotSM->GetComponentLocation() , PlayerLanternPivotSM->GetComponentRotation());

If I comment out the above line the character once again moves correctly. Note: the Lantern SM i’m position isn’t parented to anything within the map.

#include "MM2.h"
#include "PlayerLanternController.h"

// Sets default values
     // Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
    PrimaryActorTick.bCanEverTick = true;

// Called when the game starts or when spawned
void APlayerLanternController::BeginPlay()

    // Find the Character
    ACharacter* playerCharacter = UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);

    if (playerCharacter)
        // Find ViewActorPivot Static Mesh Component
        TArray<UStaticMeshComponent*> OwnersStaticMeshComponents;

        for (int32 i = 0; i < OwnersStaticMeshComponents.Num(); i++)
            if (OwnersStaticMeshComponents*->GetName().Equals("PlayerLanternPivot"))
                PlayerLanternPivotSM = OwnersStaticMeshComponents*;

    // Find the Lantern SM - this is what needs positioning and rotating to the pivotSM on the Character
    TArray<UStaticMeshComponent*> LanternMeshComponents;
    LanternSM = LanternMeshComponents[0];

// Called every frame
void APlayerLanternController::Tick(float DeltaTime)

    if (PlayerLanternPivotSM)
        // Move the position of the lantern to the Pivot
        LanternSM->SetWorldLocationAndRotation(PlayerLanternPivotSM->GetComponentLocation() , PlayerLanternPivotSM->GetComponentRotation());

I guess it’s something extremely simple, but you know the feeling when you can’t see the woods for the trees!


Sounds strange. You sure there isn’t some code in the lantern that rotates the player some way? Or maybe other code somewhere else that references the lantern and influences the players transform?

If you comment the offending line and put some SetWorldLocationAndRotation code into tick of the Lantern (let the lantern move on its own), what happens?

Many thanks for looking at this for me.

The above code is on the Lantern BP (the blueprint inherits from PlayerLanternController.h). As you see from the snippet above the lantern finds the character and the pivot and moves itself, there isn’t any functionality on the character or charactercontroller at all. hmmm, it is strange for sure.

You can try to ask the Character for an AttachParent. Maybe… just try and see what happens

Quick update… on the Character actor there are a few other StaticMesh components, so i tried positioning the lantern to those and everything worked fine; who’d figure! I then went back to positioning the lantern to my pivot StaticMesh and everything was fine… woo hoo, all fixed i said. I then tried a few other tests and it broke again, so i reverted. Bottomline is it’s working now and i don’t know why or how. Nothing has been changed. No code or Actor setups.

My only thoughts on this is, maybe™, the BeginPlay() function on the character actor needed to be been called before the Lantern? Tbh, I have no real idea. Coming originally from Unity, i know that their Start() functions are random in there execution but you can force GameObjects’ Start() methods to be called before others. Is there a way in UE4 to make an Actor’s BeginPlay() be called before another’s?

Welcome to Unreal…

You can add dependencies for Tick but not fot BeginPlay, AFAIK.

order should not matter if you havn’t got code in there that needs proper order.

Edit: Just today I had a horrible compile session again, cause code that was compiling properly for month, just out lf nowhere, spit errors like hell cause of missing includes.

Might be Unity build?

It hides actual include errors and causes fake include errors. I never use it. #NotEvenOnce

Ah, went in the wrong thread…


I observe an issue similar to the original post. The placement of the static mesh is altering the behavior of character movement. Forward movement no longer works the farther back the skeletal mesh is placed. The player character struggles to move forward or moves entirely backwards depending on the animation playing.

If I solve it, I’ll be sure to post back on this thread for the next poor soul struggling with this issue.

Thanks in advance for any tips or suggestions.

With gratitude,


Update: If I swap out the weapon blueprint for the default gun skeleton mesh that comes with the unreal templates the issue does not occur.

What about my custom skeletal mesh/blueprint might impact character movement like this?

Thanks again.

My issue was solved by updating all of the weapon meshes in my blueprint instance to No Collision.

I hope this helps someone.