Simulate cable componenet in component space

I’m wanting to have a cable component that is attached on both ends to different parts of a a moving pawn. When said pawn moves at a decent speed the cables start spazzing out due to the motion. I would like to be able to run the simulation in component space so that this isn’t an issue. Is there a way for me to make this happen in C++ (I haven’t seen anything for it in BP yet, but I may have just overlooked it)


For any who are interested, we ended up just modifying some of the c++ code to add this feature.

Facing the same problem atm. Could we see the changes you made?

I’ll try to find it after I get off work today

Hi there, any chance you’d share your workaround? Cheers :slight_smile:

This is still the first thing that comes up when you Google this issue. I’ll leave this answer here for anyone else stumbling across it. Turns out it’s really easy to set the cable up to simulate locally. The required code is already in UCableComponent, it’s just not used.

Create a child C++ class from UCableComponent called ULocalCableComponent, and have this as .h:

// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "CableComponent.h"
#include "LocalCableComponent.generated.h"
UCLASS(hidecategories = (Object, Physics, Activation, "Components|Activation"), editinlinenew, meta = (BlueprintSpawnableComponent), ClassGroup = Rendering)
class YOURPROJECTNAME_API ULocalCableComponent : public UCableComponent
	virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
	FVector _previousWorldLocation;

and .cpp:

// Fill out your copyright notice in the Description page of Project Settings.
#include "LocalCableComponent.h"
void ULocalCableComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
		ApplyWorldOffset(GetComponentLocation() - _previousWorldLocation, false);
	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
	_previousWorldLocation = GetComponentLocation();

I’ve also written a quick blog post about it if you’d like some more guidance: Simulating cable components in local space.

Hey, I’m trying to do this, but on a skeletal mesh. I tried your solution but it didn’t work, do you have any idea what I should do instead to make it work?