HingeJoint クラスと PhysicMaterial クラスで、バネの力を加えるために使用されます。
function Start() {
var hinge = GetComponent.<HingeJoint>();
// Make the spring reach shoot for a 70 degree angle.
// This could be used to fire off a catapult.
var spring = hinge.spring;
spring.spring = 10;
spring.damper = 3;
spring.targetPosition = 70;
hinge.spring = spring;
}
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void Start() { HingeJoint hinge = GetComponent<HingeJoint>(); JointSpring spring = hinge.spring; spring.spring = 10; spring.damper = 3; spring.targetPosition = 70; hinge.spring = spring; } }
| damper | バネの振幅を軽減する力。 |
| spring | バネの力。 |
| targetPosition | バネが戻ろうとする目標位置。 |