Question by
loganhoelscher123 · Oct 08, 2020 at 06:26 AM ·
physicsjointsjointconfigurable jointconfigurable
How to keep Configurable Joint from stretching?
Hello,
I'm trying to make a grappling hook using a configurable joint, a line renderer, and raycast. I don't want the joint to be able to stretch or have any spring like qualities; I just want the joint to have a fixed length between the player and the platform so I can swing back and forth launch from the grapple using the player's momentum. However the joint length gets longer and longer as the player moves further away from the grapple hit point.
RaycastHit hit;
if (Physics.Raycast(cam.position, cam.forward, out hit, maxDist, canGrapple))
{
grapplePoint = hit.point;
hook = Instantiate(hookPrefab, grapplePoint, transform.rotation) as GameObject;
config = player.gameObject.AddComponent<ConfigurableJoint>();
config.anchor = grapplePoint;
config.angularXMotion = ConfigurableJointMotion.Locked;
config.angularYMotion = ConfigurableJointMotion.Locked;
config.angularZMotion = ConfigurableJointMotion.Free;
Is there a way I can set the maximum length of the joint to the distance between the grapple point and the grapple origin (player)?
Comment