Click or drag to resize

IJointUtilsSetupPrismaticJoint Method

Sets up joint so what it becomes a prismatic joint.

Namespace:  KASAPIv2
Assembly:  KAS-API-v2 (in KAS-API-v2.dll) Version: KAS API v2
Syntax
C#
void SetupPrismaticJoint(
	ConfigurableJoint joint,
	float springForce = 0f,
	float springDamperRatio = 0.1f,
	float maxSpringForce = ∞f,
	float distanceLimit = ∞f,
	float distanceLimitForce = 0f,
	float distanceLimitDamperRatio = 0.1f
)
Request Example View Source

Parameters

joint
Type: UnityEngineConfigurableJoint
Joint to setup.
springForce (Optional)
Type: SystemSingle
Force to apply per unit of linear stretching to return the joined bodies back to the original distance. Also, see remarks to the method.
springDamperRatio (Optional)
Type: SystemSingle
Percentage of the spring force to use for dampering oscillation effect.
maxSpringForce (Optional)
Type: SystemSingle
Maximum spring force to apply when joint distance deviates from the original.
distanceLimit (Optional)
Type: SystemSingle
Maximum allowed distance relative to the original value. Also, see remarks to the method.
distanceLimitForce (Optional)
Type: SystemSingle
Force to apply to keep distance in limits. If it's 0 then the limit is impassible.
distanceLimitDamperRatio (Optional)
Type: SystemSingle
Percentage of the limit force to use for dampering oscillation effect.
Remarks

It's a standard PhysX configuration. Main axis is set to Z. Moving along it is allowed but can be constrained by a spring and limit. Drive mode is set to Position.

Only main axis linear settings are changed. Consider using ResetJoint(ConfigurableJoint) to eliminate side effects from the previous settings of the joint.

Pure prismatic joint assumes 5 out of the 6 degrees of freedom to be locked (everything, except the main axis linear motion). Consider setting enablePreprocessing to true since it may improve PhysX performance.

For performance reasons some parameters combindations may result in different motion modes:

  • When springForce is Infinite or distanceLimit is 0 the main axis linear movement mode is set to Locked. If you plan to change force/limit don't forget to update the modes as well.
  • When springForce is 0 and distanceLimit is Infinite the main axis linear movement mode is set to Free. If you plan to change either of the parameters don't forget to update the mode as well.

Regardless to the modes set all the other parameters are also applied. I.e. you don't need to re-apply them when changing mode.

See Also