// Use this for initialization void Start() { plung = GameObject.Find("plungerBase").GetComponent <PlungerBase> (); trap = GameObject.Find("TrapWall").GetComponent <TrapBehaviour> (); ballBody = GameObject.Find("Ball").GetComponent <Rigidbody> (); Input.gyro.enabled = true; shakeActive = false; originalPos = transform.position; }
// Use this for initialization void Start () { // Retreive the hinge joint attached to flipper paddle hinge = GetComponent<HingeJoint>(); // Set it using a spring hinge.useSpring = true; hinge.useLimits = true; plung = GameObject.Find ("plungerBase").GetComponent<PlungerBase> (); }
// Rigidbody of plunger: is kinematic and use gravity true // Use this for initialization void Start() { pressed = false; plungB = GameObject.Find("plungerBase").GetComponent <PlungerBase> (); plunger = GetComponent <Rigidbody>(); plunger.freezeRotation = true; plunger.constraints = RigidbodyConstraints.FreezePositionZ; plunger.constraints = RigidbodyConstraints.FreezePositionY; plunger.constraints = RigidbodyConstraints.FreezeRotationX; plunger.constraints = RigidbodyConstraints.FreezeRotationY; plunger.constraints = RigidbodyConstraints.FreezeRotationZ; origConstr = plunger.constraints; // PLungers rest position restPos = plunger.position; currentPos = plunger.position.z; forceApplied = false; }