The spring attempts to reach a target angle by adding spring and damping forces.
// Make the spring reach shoot for a 70 degree angle. // This could be used to fire off a catapult. hingeJoint.spring.spring = 10; hingeJoint.spring.damper = 3; hingeJoint.spring.targetPosition = 70;
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { void Example() { hingeJoint.spring.spring = 10; hingeJoint.spring.damper = 3; hingeJoint.spring.targetPosition = 70; } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): def Example() as void: hingeJoint.spring.spring = 10 hingeJoint.spring.damper = 3 hingeJoint.spring.targetPosition = 70