it's done using the setParent function with JOINT_PRISMATIC mode:
cubeObj.setParent(playerObj, jointType=1, jointAxis=[0,0,1], ...)
the logic for the spring is:
if self.inputs.getKeyState("RMB")==1:#right mouse button justPressed
cubeObj.jointController.set_targetPosition(pos=-1.5, force=5000)
if self.inputs.getKeyState("RMB")==3:#right mouse button justReleased
cubeObj.jointController.set_targetPosition(pos=0, force=400)
0 Comments