Hi,
I want to make a script so that i can freeze the X, Z rotation and the Z position.
But when I attach the script to my gameObject it won’t work.
Here is the script so far.
var target : Transform;
function Start () {
}
function Update () {
}
function OnTriggerEnter (col : Collider) {
if(col.gameObject.tag == "mijnobject") {
GetComponent.<Rigidbody>().constraints = RigidbodyConstraints.FreezePositionX;
GetComponent.<Rigidbody>().constraints = RigidbodyConstraints.FreezePositionY;
yield WaitForSeconds(0.1);
this.GetComponent.<ConstantForce>().force = Vector3.right * 60;
this.GetComponent.<Rigidbody>().useGravity = false;
GetComponent.<Rigidbody>().constraints = RigidbodyConstraints.None;
GetComponent.<Rigidbody>().constraints = RigidbodyConstraints.FreezePositionZ;
GetComponent.<Rigidbody>().constraints = RigidbodyConstraints.FreezeRotationX.FreezeRotationZ;
}
}