Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        //string txt = UI.GetComponent<Text>().text;
        theIntegrator = new SHOIntegrator();
        //GetComponent<UnityEngine.UI.Text>

        /*rb = gameObject.GetComponent<Rigidbody>();
         * theIntegrator.m = rb.mass;
         * theIntegrator.Ax = rb.drag;
         * theIntegrator.Ay = rb.drag;
         * theIntegrator.Az = rb.drag;
         * theIntegrator.Ixx = rb.inertiaTensor.x;
         * theIntegrator.Iyy = rb.inertiaTensor.z;
         * theIntegrator.Izz = rb.inertiaTensor.y;*/
        //x,y,z,x`,y`,z`,roll,pitch,yaw,roll`,pitch`,yaw`
        float[] x0 = new float[12] {
            gameObject.transform.position.x, gameObject.transform.position.z, gameObject.transform.position.y
            , 0, 0, 0, -1 * gameObject.transform.rotation.eulerAngles.x * Mathf.PI / 180, -1 * gameObject.transform.rotation.eulerAngles.z * Mathf.PI / 180,
            -1 * gameObject.transform.rotation.eulerAngles.y * Mathf.PI / 180, 0, 0, 0
        };
        //theIntegrator.m = gameObject.GetComponent<Rigidbody>().mass;
        //theIntegrator.Ax = gameObject.GetComponent<Rigidbody>().drag;
        //theIntegrator.Ay = gameObject.GetComponent<Rigidbody>().drag;
        //theIntegrator.Az = gameObject.GetComponent<Rigidbody>().drag;
        //data = new List<float[]>();
        //time = new List<float>();
        theIntegrator.SetIC(x0);
    }
Ejemplo n.º 2
0
    void Start()
    {
        Collider collider = ColliderTransform.GetComponent <Collider>();

        theIntegrator     = new SHOIntegrator();
        rb                = gameObject.GetComponent <Rigidbody>();
        theIntegrator.m   = UIButton.mass;
        theIntegrator.l   = UIButton.length;
        theIntegrator.Ax  = UIButton.ax;
        theIntegrator.Ay  = UIButton.ay;
        theIntegrator.Az  = UIButton.az;
        theIntegrator.Ixx = UIButton.ixx;
        theIntegrator.Iyy = UIButton.iyy;
        theIntegrator.Izz = UIButton.izz;
        theIntegrator.k   = UIButton.k;
        theIntegrator.b   = UIButton.b;
        gameObject.transform.localScale = new Vector3(theIntegrator.l / 0.225f, theIntegrator.l / 0.225f, theIntegrator.l / 0.225f);
        gameObject.transform.Translate(Vector3.up * theIntegrator.l / 0.45f);
        float[] x0 = new float[12] {
            UIButton.posX, UIButton.posY, UIButton.posZ + 0.5f
            , 0, 0, 0, -1 * gameObject.transform.rotation.eulerAngles.x * Mathf.PI / 180, -1 * gameObject.transform.rotation.eulerAngles.z * Mathf.PI / 180,
            -1 * UIButton.rotZ * Mathf.PI / 180, 0, 0, 0
        };
        gameObject.transform.position = new Vector3(UIButton.posX, UIButton.posZ + 0.5f, UIButton.posY);
        gameObject.transform.rotation = Quaternion.Euler(0, UIButton.rotZ, 0);
        Xsave = x0;
        theIntegrator.SetIC(x0);
    }
Ejemplo n.º 3
0
    // Use this for initialization
    void Start()
    {
        theIntegrator = new SHOIntegrator();
        Transform t = this.transform;

        while (t.parent != null && t.tag != "Player")
        {
            t = t.parent;
        }
        rBody = t.GetComponent <Rigidbody>();
    }