Click or drag to resize

ILinkCableJointSetCableLength Method

Sets the maximum possible distance between the source and the head/target physical anchors.

Namespace:  KASAPIv2
Assembly:  KAS-API-v2 (in KAS-API-v2.dll) Version: KAS API v2
Syntax
C#
void SetCableLength(
	float length
)
Request Example View Source

Parameters

length
Type: SystemSingle
The new length. The value must be in range [0; cfgMaxCableLength]. If the value is not within the limits, then it's rounded to the closest boundary. Also, there are special values:
  • PositiveInfinity. Set the length to the maximum possible value, configured via cfgMaxCableLength.
  • NegativeInfinity. Set the limit to the real distance, but only if the real distance is less than the current limit. When the real distance is greater than the limit, it means the cable is under a strain due to the physical forces, and nothing will be changed to not trigger extra effects.
Remarks

Setting the new length may trigger the physical effects if the value is less than the real cable length, since it will force the engine to pull the objects together. Don't reduce the length too rapidly to avoid the strong forces applied.

Calling for this method doesn't have any effect if the PhysX joint is not created. When a brand new joint is created, it always has the distance limit set to the actual distance between the physical objects. I.e. this method must be called after the physical joint is created.

See Also