jwtrp
(jwtrp)
August 20, 2023, 7:17pm
1
Hello, anyone knows why the cable component behaves strange?
It just kinda “restarts” the simulation everytime there is a movement happening after it was in rest position… or something like that.
Also: if I attach it to another scene component, it does not even “relax” but just stays in a straight positon.
Video for reference:
3 Likes
Did you find a solution for this? I have a similar problem here . Just attached an unmodified cable component to a player character and it behaved the same way.
1 Like
Vahab
(Vahab Ahmadvand)
October 23, 2023, 7:44pm
3
How did you connect the cable to the actors? As far as I know, if you manually move the first point, it will be simulated again, you should only attach and move the end point.
1 Like
Ixcelsius
(Ixcelsius)
October 24, 2023, 10:50pm
4
I have the same issue as well. I believe it is a bug since it used to work in older UE versions. Hopefully someone can find a workaround soon.
2 Likes
Same. This works perfectly for me in UE 4.26.
Sharsnik
(Sharsnik)
November 14, 2023, 10:41am
6
Is this video in the Editor or in the Packed Build? The resetting seems to occur when OnTransformUpdate is called on the Cable component, via this code:
Line 390 in CableComponent.cpp
#if WITH_EDITOR
void UCableComponent::OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport)
{
Super::OnUpdateTransform(UpdateTransformFlags, Teleport);
InitParticles();
UpdateBounds();
}
#endif
I believe this is what happens when, as Vahab Ahmadvand said, you move the parent actor of the Cable Component.
However, I just tested it, and it seems like this behvaior DOES NOT persist in the Packaged Build (as you’d expect from the WITH_EDITOR tags).
Can you test to see if the behavior is fixed in the Packaged Build for you as well?
UE noob here, how should I fix this behavior in the editor? Can I somehow edit the original cable C++ code to remove that part?
jwtrp
(jwtrp)
December 11, 2023, 11:44am
8
thanks for that - will give it a try at some point - Moved away from the solution since I didn’t find a hint on how to fix it until now.
Workaround: Subclass to Fix PIE Physics Reset (No Engine Modification)
Based on Sharsnik’s findings, I created a subclass that skips InitParticles() only during PIE while preserving normal editor behavior:
MyCableComponent.h:
UCLASS(ClassGroup=Rendering, meta=(BlueprintSpawnableComponent))
class UMyCableComponent : public UCableComponent
{
GENERATED_BODY()
public:
UMyCableComponent(const FObjectInitializer& ObjectInitializer);
#if WITH_EDITOR
virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport) override;
#endif
};
MyCableComponent.cpp:
UMyCableComponent::UMyCableComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
#if WITH_EDITOR
void UMyCableComponent::OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport)
{
UWorld* World = GetWorld();
if (World && World->IsPlayInEditor())
{
// PIE: Skip InitParticles() to prevent physics reset
USceneComponent::OnUpdateTransform(UpdateTransformFlags, Teleport);
UpdateBounds();
}
else
{
// Editor: Normal behavior for level design
Super::OnUpdateTransform(UpdateTransformFlags, Teleport);
}
}
#endif
Add "CableComponent" to your Build.cs dependencies. Works on UE 5.3.