public override void OnSyncedUpdate()
        {
            //if (useSpring)
            //{
            //	//Adding a spring and damper Term to the Equation of Motion
            //	thisBody.AddTorque ((-1) * TSWorldAxis * ((thisJoint.getHingeAngle () - Spring.tagetPosition) * Spring.spring + thisJoint.getAngularVel () * Spring.damper));
            //}

            if (Input.GetKeyDown(KeyCode.T))
            {
                thisBody.AddTorque(new Vector3(0, 90, 0).ToTSVector());
            }

            Debug.Log(thisJoint.getHingeAngle() + " : " + thisJoint.getAngularVel());

            //thisBody.tsTransform.rotation = TSQuaternion.Euler (TSMath.Clamp (thisBody.tsTransform.eulerAngles.x, -30, 30), thisBody.tsTransform.eulerAngles.y, thisBody.tsTransform.eulerAngles.z);

            //CharacterJoint;

            if (TSMath.Abs(thisJoint.AppliedImpulse) >= breakForce)             //@TODO: Add break torque
            {
                thisJoint.Deactivate();
                Destroy(this);
            }
        }
Exemplo n.º 2
0
        public override void OnSyncedUpdate()
        {
            if (useSpring)
            {
                //Adding a spring and damper Term to the Equation of Motion
                thisBody.AddTorque((-1) * TSWorldAxis * ((thisJoint.getHingeAngle() - Spring.tagetPosition) * Spring.spring + thisJoint.getAngularVel() * Spring.damper));
            }

            //if (TSMath.Abs (thisJoint.AppliedImpulse) >= breakForce)//@TODO: Add break torque
            //{
            //	thisJoint.Deactivate ();
            //	Destroy (this);
            //}
        }