Set Cable Component Number of Segments from blueprint?

Hello everyone!

I’m working with a simulation that requires cable components to be dynamically created. One issue that I’m running into is that there does not seem to be a node that allows you to modify a cable component’s number of segments.

Ideally, I would like to modify the segment number based on the size of rope spawned (ex: # of segments is the length / 10). This only needs to occur during the initialization of a cable. Once the number of segments is set, that is the number until the cable is destroyed. Is this a missing feature, or am I going about this wrong?

Thanks!

Hello Alex Fries,

Good question, I checked, and also found that this was absent:

I checked the cable component code, and found that NumSegments is set to ‘BlueprintReadOnly’ (as opposed to BlueprintReadWrite)

	/** Rest length of the cable */
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Cable", meta=(ClampMin = "0.0", UIMin = "0.0", UIMax = "1000.0"))
	float CableLength;

	/** How many segments the cable has */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Cable", meta=(ClampMin = "1", UIMin = "1", UIMax = "20"))
	int32 NumSegments;

So at this point you may be able to create your own CPP cable component with that change. (I don’t THINK you’d need to compile a custom version of the engine to change this) And then again, maybe there is a good reason why NumSegments is ReadOnly.

Cheers!

2 Likes

Yep! That would do it!

I did, in fact, have to rebuild the engine from scratch. I’ve tested it very little, but it does work!

Thanks for pointing it out!

1 Like

I try it out and when I change the NumSegments at runtime it crashes. So for me it does not work.