When a BP spawns another, if the spawned Actor has a non-root child component that is simulating physics, on clients, immediately after spawn, the child component will have the world position doubled when compared to the spawned actor.
This can be verified by printing the world position of the component on Begin Play or using debug spheres, as suggested by the licensee.
Some time later the position gets corrected - probably due to replication.
I've verified using Chaos Visual Debugger that the physics object is spawned in the correct position.
I've suggested, as a workaround, that the component be made root, that way the offset is gone. This only manifests if the component is not the root, but a child component.
Using the repro project:
Play in Editor with Netmode: Play as Client
Check that the debug sphere of the child component is offset by double the actor spawn position
From scratch:
Create an empty project
Create an actor blueprint with a scene component. Add a cube to the scene component as a child, not root.
(Just as a sanity check confirm there is no offset between the child component and the root)
Enable replication and replicated movement on the actor defaults.
On the cube, enable "Simulate Physics" and "Component Replicates"
Create a second actor blueprint, and in BeginPlay add a Delay node with 5 seconds and then a Spawn Actor of Class node linking the previously created actor blueprint.
Place the spawner in your level.
Set net mode to play as client and Play in Editor
Optional:
Add a DrawDebugSphere on tick to the actor blueprint with its world location and a duration of 2 seconds. Makes it easier to see the issue.
Expected result: the child component should spawn in the same position as the actor BP
Actual result: the child component spawns roughly at double the offset between the position where the actor is spawned and the zero of the world, like the offset is being added to the component position as a local transform. This is corrected some time later, probably caused by replication.
I'm unsure where the issue originates so I'm attaching the callstack to FixupNativeActorComponents
> UnrealEditor-Engine.dll!FixupNativeActorComponents(AActor * Actor) Line 3773 C++
UnrealEditor-Engine.dll!AActor::PostSpawnInitialize(const UE::Math::TTransform<double> & UserSpawnTransform, AActor * InOwner, APawn * InInstigator, bool bRemoteOwned, bool bNoFail, bool bDeferConstruction, ESpawnActorScaleMethod TransformScaleMethod) Line 3851 C++
UnrealEditor-Engine.dll!UWorld::SpawnActor(UClass * Class, const UE::Math::TTransform<double> * UserTransformPtr, const FActorSpawnParameters & SpawnParameters) Line 736 C++
UnrealEditor-Engine.dll!UWorld::SpawnActor(UClass * Class, const UE::Math::TVector<double> * Location, const UE::Math::TRotator<double> * Rotation, const FActorSpawnParameters & SpawnParameters) Line 440 C++
UnrealEditor-Engine.dll!UWorld::SpawnActor<AWorldSettings>(UClass * Class, const FActorSpawnParameters & SpawnParameters) Line 3396 C++
UnrealEditor-Engine.dll!UWorld::InitializeNewWorld(const FWorldInitializationValues IVS, bool bInSkipInitWorld) Line 2385 C++
UnrealEditor-Engine.dll!UWorld::CreateWorld(const EWorldType::Type InWorldType, bool bInformEngineOfWorld, FName WorldName, UPackage * InWorldPackage, bool bAddToRoot, ERHIFeatureLevel::Type InFeatureLevel, const FWorldInitializationValues * InIVS, bool bInSkipInitWorld) Line 2518 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::CreatePIEWorldFromEntry(FWorldContext & WorldContext, UWorld * InWorld, FString & PlayWorldMapName) Line 2415 C++
UnrealEditor-Engine.dll!UGameInstance::InitializeForPlayInEditor(int PIEInstanceIndex, const FGameInstancePIEParameters & Params) Line 319 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::CreateInnerProcessPIEGameInstance(FRequestPlaySessionParams & InParams, const FGameInstancePIEParameters & InPIEParameters, int InPIEInstanceIndex) Line 2971 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::OnLoginPIEComplete_Deferred(int LocalUserNum, bool bWasSuccessful, FString ErrorString, FPieLoginStruct DataStruct) Line 1599 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::CreateNewPlayInEditorInstance(FRequestPlaySessionParams & InRequestParams, const bool bInDedicatedInstance, const EPlayNetMode InNetMode) Line 1862 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::StartPlayInEditorSession(FRequestPlaySessionParams & InRequestParams) Line 2884 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::StartQueuedPlaySessionRequestImpl() Line 1176 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::StartQueuedPlaySessionRequest() Line 1077 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 2027 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 550 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5869 C++
[Inline Frame] UnrealEditor.exe!EngineTick() Line 69 C++
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 188 C++
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 266 C++
UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 317 C++
[External Code]
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-239413 in the post.
0 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 5.5.1 |
Target Fix | 5.6 |
Created | Jan 20, 2025 |
---|---|
Updated | Jan 29, 2025 |