示例#1
0
 void Awake()
 {
     rb1 = Body1.GetComponent <Rigidbody>();
     rb2 = Body2.GetComponent <Rigidbody>();
     rb3 = Body3.GetComponent <Rigidbody>();
     rb5 = Body5.GetComponent <Rigidbody>();
     rb6 = Body6.GetComponent <Rigidbody>();
 }
示例#2
0
 void setRigibody()
 {
     this.rb1 = Body1.GetComponent <Rigidbody>();
     this.rb2 = Body2.GetComponent <Rigidbody>();
     this.rb3 = Body3.GetComponent <Rigidbody>();
     this.rb4 = Body4.GetComponent <Rigidbody>();
     this.rb5 = Body5.GetComponent <Rigidbody>();
     this.rb6 = Body6.GetComponent <Rigidbody>();
 }
示例#3
0
    void Awake()
    {
        rb1 = Body1.GetComponent <Rigidbody>();
        rb2 = Body2.GetComponent <Rigidbody>();
        rb3 = Body3.GetComponent <Rigidbody>();
        rb4 = Body4.GetComponent <Rigidbody>();
        rb5 = Body5.GetComponent <Rigidbody>();
        rb6 = Body6.GetComponent <Rigidbody>();
        GameObject tor = this.chita.transform.GetChild(0).gameObject;

        torax        = tor.GetComponent <Rigidbody>();
        testeColisao = this.chita.transform.GetChild(13).gameObject;
        //chita = GameObject.Find("Chita");
        //z = new Animalx ();
        //a = GameObject.Instantiate (chita);
        //a.transform.position = new Vector3 (-2.16f,0.16f,-5f);
    }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        //Vector3 force1 = 30*ks*(desiredPos - rb1.position) - 30*kd*(rb1.velocity);
        //rb1.AddForce(force1);
        //float torque1 = 30*ks*(angle1 - Body1.GetComponent<HingeJoint>().angle) - kd*(Body1.GetComponent<HingeJoint>().velocity);
        //rb1.AddTorque(Vector3.forward * torque1);

        float torque2 = 30 * ks * (angle2 - Body2.GetComponent <HingeJoint>().angle) - kd * (Body2.GetComponent <HingeJoint>().velocity);

        rb1.AddTorque(Vector3.forward * torque2);
        rb2.AddTorque(Vector3.forward * torque2);
        float torque3 = 30 * ks * (angle3 - Body3.GetComponent <HingeJoint>().angle) - kd * (Body3.GetComponent <HingeJoint>().velocity);

        rb3.AddTorque(Vector3.forward * torque3);

        float torque5 = 30 * ks * (angle5 - Body5.GetComponent <HingeJoint>().angle) - kd * (Body5.GetComponent <HingeJoint>().velocity);

        rb5.AddTorque(Vector3.forward * torque5);
        float torque6 = 30 * ks * (angle6 - Body6.GetComponent <HingeJoint>().angle) - kd * (Body6.GetComponent <HingeJoint>().velocity);

        rb6.AddTorque(Vector3.forward * torque6);
    }