FBodyInstance::Weld did not check to see whether or not child components were already welded to a parent. This meant that whenever Weld was called, ShapeToBodiesMap would continue to grow in size, even if there were no new bodies.
1. Create a new C++ project. Use the 3rd person template (for convenience).
2. Compile and run this in Debug mode.
3. Create a BP class derived from the standard ThirdPersonCharacter with nested primitive components (e.g. a sphere component that contains another sphere component).
4. Create a way to toggle physics on and off for the parent primitive component.
e.g. Add an Input Event for Left Mouse.
Add an Event Handler in the new BP class for this event.
Create a Flip Flop node.
For both A and B exec pins, call SetSimulatePhysics on the Parent
Sphere Component with the IsA output pin connected to the
input pin
5. Create a BP class derived from the standard ThirdPersonGameMode class.
6. Change the default Game Mode to the new Game Mode, and set the default pawn to the new pawn.
e.g. Edit > Project Settings > Maps and Modes > Default Modes
> Default GameMode = NewMode
> Default Pawn Class = NewPawnClass
7. Set a break point in the beginning of the BodyInstance.cpp FBodyInstance::Weld method.
8. Toggle Physics on and off repeatedly (using the event handler above, noting this will only be hit when physics switched from off to on).
Expectation: First toggle, ShapeToBodiesMap is be empty.
Subsequent toggles, ShapeToBodiesMap contains a
single reference to each of the child components.
Actual: First toggle, ShapeToBodiesMap is empty.
Subsequent toggles, ShapeToBodiesMap contains multiple references to each of the child components
(namely, the number of times toggled number of references).
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-31189 in the post.
0 |
Component | UE - Simulation - Physics |
---|---|
Affects Versions | 4.11, 4.12, 4.13 |
Target Fix | 4.13 |
Fix Commit | 2988123 |
---|---|
Main Commit | 2994701 |
Created | May 23, 2016 |
---|---|
Resolved | May 24, 2016 |
Updated | Apr 27, 2018 |