# Simulate cable componenet in component space

**URL:** <https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336>\
**Category:** World Creation\
**Tags:** cablecomponent, component-space, unreal-engine, Physics, question\
**Created:** [April 19, 2017, 3:54pm UTC](https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336 "2017-04-19T15:54:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_5de361e8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5de361e8](https://forums.unrealengine.com/u/anonymous_user_5de361e8)\
**Post date:** [April 19, 2017, 3:54pm UTC](https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336/1 "2017-04-19T15:54:07Z")

</div>

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)

Thanks!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5de361e8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5de361e8](https://forums.unrealengine.com/u/anonymous_user_5de361e8)\
**Post date:** [May 23, 2017, 8:02pm UTC](https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336/2 "2017-05-23T20:02:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AyanMiru](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ayanmiru/32/1194638_2.png) [@AyanMiru](https://forums.unrealengine.com/u/AyanMiru)\
**Post date:** [January 8, 2018, 9:51am UTC](https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336/3 "2018-01-08T09:51:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5de361e8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5de361e8](https://forums.unrealengine.com/u/anonymous_user_5de361e8)\
**Post date:** [January 8, 2018, 4:45pm UTC](https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336/4 "2018-01-08T16:45:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Philcrifo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/philcrifo/32/676254_2.png) [@Philcrifo](https://forums.unrealengine.com/u/Philcrifo)\
**Post date:** [July 24, 2018, 1:29pm UTC](https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336/5 "2018-07-24T13:29:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Lhorkan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lhorkan](https://forums.unrealengine.com/u/Lhorkan)\
**Post date:** [January 25, 2019, 7:18am UTC](https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336/6 "2019-01-25T07:18:35Z")

</div>

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
{
	GENERATED_BODY()
 
public:
	virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
	
protected:
	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)
{
	if(!_previousWorldLocation.IsZero())
	{
		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](http://thomasmountainborn.com/2019/01/25/unreal-quick-tip-simulating-cable-components-in-local-space/).

---

<div class="post-metadata">

**Author:** ![lucota90](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@lucota90](https://forums.unrealengine.com/u/lucota90)\
**Post date:** [October 19, 2022, 9:39pm UTC](https://forums.unrealengine.com/t/simulate-cable-componenet-in-component-space/391336/7 "2022-10-19T21:39:08Z")

</div>

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?
