Calling BodyInstance.UpdateBodyScale displays erratic behaviors and does not update the rendering scale.
The licensee has reported and presented a repro project that displays the erratic behavior of trying to animate the scaling of a BodyInstance. The rendering side never updates the scale along with the physics side. Instead of a smooth animation, sometimes the scale fluctuates up and down between frames.
To reproduce in the attached repro project:
Attach Chaos Visual Debugger to a simulating Play In Editor session and see the scale fluctuating erratically.
To manually recreate the scene:
Create a new project.
Create a new level basic.
Create a StaticMeshActor Blueprint, set it's StaticMesh to any Engine default, and spawn it in the scene.
Create a C++ ActorComponent.
Add to the header:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Components")
UPrimitiveComponent* ComponentRoot;
To the TickComponent add:
Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
if (ComponentRoot)
{
if (ScaleTimer < 5.0f)
else if (ScaleTimer < 10.0f)
{ const FVector Scale = FMath::GetMappedRangeValueClamped(FVector2D(5.0f, 10.0f), FVector2D(0.1f, 3.0f), ScaleTimer) * FVector::One(); ComponentRoot->BodyInstance.UpdateBodyScale(Scale); UE_LOG(LogTemp, Warning, TEXT("Scale: %s"), *Scale.ToString()); }else if (ScaleTimer > 14.0f)
{ ScaleTimer = 0.0f; }}
ScaleTimer += DeltaTime;
Save and compile.
Back in the Editor, add it to the StaticMeshActorBP that is spawned in the scene.
Select the BP and select the ActorComponent, in the Details Panel set the ComponentRoot to be the StaticMeshComponent.
Save the scene and setup.
Go to Tool>Debug>ChaosVisualDebugger (CVD)
Play in Editor the level or simulate it.
In CVD, connect to live session and navigate so the BP can be seen.
It's expected that the scale would be fluctuating smoothly.
In actuality the scale behaves in an erratic manner.
> UnrealEditor-Engine.dll!FBodyInstance::UpdateBodyScale(const UE::Math::TVector<double> & InScale3D, bool bForceUpdate) Line 1972 C++
UnrealEditor-PhysicsSyncIssues.dll!UChangePhysicsSettings::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) Line 65 C++
[Inline Frame] UnrealEditor-Engine.dll!FActorComponentTickFunction::ExecuteTick::__l2::<lambda_1>::operator()(float) Line 1172 C++
UnrealEditor-Engine.dll!??$ExecuteTickHelper@V<lambda_1>@?1??ExecuteTick@FActorComponentTickFunction@@UEAAXMW4ELevelTick@@W4Type@ENamedThreads@@AEBV?$TRefCountPtr@VFGraphEvent@@@@@Z@@FActorComponentTickFunction@@SAXPEAVUActorComponent@@NMW4ELevelTick@@AEBV<lambda_1>@?1??ExecuteTick@0@UEAAXM2W4Type@ENamedThreads@@AEBV?$TRefCountPtr@VFGraphEvent@@@@@Z@@Z(UActorComponent * Target, bool bTickInEditor, float DeltaTime, ELevelTick TickType, const FActorComponentTickFunction::ExecuteTick::_l2::<lambda_1> & ExecuteTickFunc) Line 4573 C++
UnrealEditor-Engine.dll!FActorComponentTickFunction::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 1170 C++
UnrealEditor-Engine.dll!FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 278 C++
UnrealEditor-Engine.dll!TGraphTask<FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread, bool bDeleteOnCompletion) Line 1235 C++
[Inline Frame] UnrealEditor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & CurrentThread, ENamedThreads::Type) Line 840 C++
UnrealEditor-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 760 C++
UnrealEditor-Core.dll!FNamedTaskThread::ProcessTasksUntilIdle(int QueueIndex) Line 662 C++
UnrealEditor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 573 C++
UnrealEditor-Engine.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 1583 C++
UnrealEditor-Engine.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 772 C++
UnrealEditor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1514 C++
UnrealEditor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 2015 C++
UnrealEditor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 550 C++
UnrealEditor.exe!FEngineLoop::Tick() Line 5921 C++
[Inline Frame] UnrealEditor.exe!EngineTick() Line 61 C++
UnrealEditor.exe!GuardedMain(const wchar_t * CmdLine) Line 180 C++
UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow, const wchar_t * CmdLine) Line 247 C++
UnrealEditor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * pCmdLine, int nCmdShow) Line 298 C++
[External Code]
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-231242 in the post.
0 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 5.6, 5.4.4 |
Target Fix | 5.6 |
Created | Nov 22, 2024 |
---|---|
Updated | Nov 26, 2024 |