Exemple #1
0
    // Update is called once per frame
    public void FixedUpdate()
    {
        Vector3    pos;
        Quaternion orient;


        bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);

        if (!res)
        {
//			Debug.Log("Error getting object pose");
            return;
        }
        transform.localPosition = pos;
        transform.localRotation = orient;
        FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
    }
Exemple #2
0
    // Update is called once per frame
    public void FixedUpdate()
    {
        Vector3    pos;
        Quaternion orient;


        bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);

        if (!res)
        {
//			Debug.Log("Error getting object pose");
            return;
        }
        transform.localPosition = pos;
        transform.localRotation = orient;

        FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);

        FalconUnity.lerpSpring(springId, max_force, dampingFactor, springPos, springOrientation, posConstraintLower, posConstraintUpper, orientConstraintCCW, orientConstraintCW, directionality, 0);
//		FalconUnity.setSpring(springId,max_force,goalPos,goalOrient,pConstraintl,pConstraintu, oConstraintl, oConstraintu);
    }
    public void Update()
    {
        Vector3    pos;
        Quaternion orient;

        if (contador.bodynum == 0)

        {
            if (gameObject.tag == "cubo" || gameObject.tag == "cilindro" || gameObject.tag == "octa" || gameObject.tag == "triangulo" || gameObject.tag == "cubo_peque" || gameObject.tag == "cilindro_peque" || gameObject.tag == "octa_peque" || gameObject.tag == "triangulo_peque")
            {
                bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
                if (!res)
                {
                    //			Debug.Log("Error getting object pose");
                    return;
                }
                transform.localPosition = pos;
                transform.localRotation = orient;
                FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
            }    /*
                  * if (gameObject.tag == "cilindro")
                  * {
                  * bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
                  * if (!res)
                  * {
                  * //			Debug.Log("Error getting object pose");
                  * return;
                  * }
                  * transform.localPosition = pos;
                  * transform.localRotation = orient;
                  * FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
                  * }
                  * if (gameObject.tag == "octa")
                  * {
                  * bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
                  * if (!res)
                  * {
                  * //			Debug.Log("Error getting object pose");
                  * return;
                  * }
                  * transform.localPosition = pos;
                  * transform.localRotation = orient;
                  * FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
                  * }
                  * if (gameObject.tag == "triangulo")
                  * {
                  * bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
                  * if (!res)
                  * {
                  * //			Debug.Log("Error getting object pose");
                  * return;
                  * }
                  * transform.localPosition = pos;
                  * transform.localRotation = orient;
                  * FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
                  * }
                  */
        }



        //Debug.Log(bodyId);

        /*      if (bodyId == numero)
         *    {
         *        if (removido)
         *        {
         *            if (contador.activacion)
         *            {
         *                refreshShape();
         *                Debug.Log("vuelve");
         *                removido = false;
         *                contador.activacion = false;
         *            }
         *        }
         *        else
         *        {
         *            if (contador.activacion)
         *            {
         *
         *                FalconUnity.removeDynamicShape(numero);
         *                removido = true;
         *                contador.activacion = false;
         *                Destroy(gameObject);
         *            }
         *        }
         *    }*/
    }
    // Update is called once per frame
    public void FixedUpdate()
    {
        Vector3    pos;
        Quaternion orient;

        if (contador.bodynum == 1 || contador.ganador_consultorio == 1)
        {
            if (gameObject.tag == "cubo")
            {
                FalconUnity.removeDynamicShape(bodyId);
                Destroy(gameObject);
            }
            if (gameObject.tag == "cilindro")
            {
                FalconUnity.removeDynamicShape(bodyId);
                Destroy(gameObject);
            }
            if (gameObject.tag == "octa")
            {
                FalconUnity.removeDynamicShape(bodyId);
                Destroy(gameObject);
            }
            if (gameObject.tag == "triangulo")
            {
                FalconUnity.removeDynamicShape(bodyId);
                Debug.Log("destruye");
                Destroy(gameObject);
            }
            if (gameObject.tag == "cubo_peque")
            {
                Debug.Log(bodyId);
                FalconUnity.removeDynamicShape(bodyId);
                Destroy(gameObject);
            }
            if (gameObject.tag == "cilindro_peque")
            {
                FalconUnity.removeDynamicShape(bodyId);
                Destroy(gameObject);
            }
            if (gameObject.tag == "octa_peque")
            {
                FalconUnity.removeDynamicShape(bodyId);
                Destroy(gameObject);
            }
            if (gameObject.tag == "triangulo_peque")
            {
                FalconUnity.removeDynamicShape(bodyId);
                Debug.Log("destruye");
                Destroy(gameObject);
            }
            // contador.bodynum = 0;
        }

        if (gameObject.tag != "cubo" && gameObject.tag != "cilindro" && gameObject.tag != "octa" && gameObject.tag != "triangulo" && gameObject.tag != "cubo_peque" && gameObject.tag != "cilindro_peque" && gameObject.tag != "octa_peque" && gameObject.tag != "triangulo_peque")
        {
            bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
            if (!res)
            {
                //			Debug.Log("Error getting object pose");
                return;
            }
            transform.localPosition = pos;
            transform.localRotation = orient;
            FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
        }
    }
Exemple #5
0
    public void Update()
    {
        bool       res1 = FalconUnity.getFalconButtonStates(0, out botones);
        Vector3    pos;
        Quaternion orient;

        if (contador.bodynum == 0)

        {
            if (gameObject.tag == "cubo_peque" || gameObject.tag == "cilindro_peque" || gameObject.tag == "octa_peque")
            {
                bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
                if (!res)
                {
                    //			Debug.Log("Error getting object pose");
                    return;
                }
                transform.localPosition = pos;
                transform.localRotation = orient;
                FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
            }
        }
        if (gameObject.tag == "cubo_peque" || gameObject.tag == "cilindro_peque" || gameObject.tag == "octa_peque")
        {
            if (botones[1] == true)
            {
                if (contador.saber == 1 && contador.mensaje == 0)
                {
                    Debug.Log("como lo hace");
                    //FalconUnity.removeDynamicShape(bodyId);

                    bool res4 = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
                    transform.localPosition = pos;
                    transform.localRotation = orient;
                    GameObject nuevo = Instantiate(cubo, new Vector3(pos.x, pos.y - 1.5f, pos.z), cubo.transform.rotation);
                    nuevo.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
                    // FalconUnity.setDynamicShapePose(bodyId, new Vector3(pos.x, pos.y - 1f, pos.z), orient);
                    // FalconUnity.applyForceToShape(bodyId, new Vector3(0, -23, 0), new Vector3(0, 0, 0));
                    //                GetComponent<Rigidbody>().useGravity = true;
                    //Destroy(gameObject);

                    // Destroy(gameObject);
                    // Instantiate(donita1, new Vector3(pos.x, pos.y - 0.8f, pos.z), orient);
                    // gameObject.AddComponent<Rigidbody>(); // Add the rigidbody.
                    contador.saber = 0;
                    FalconUnity.removeDynamicShape(bodyId);
                    Destroy(gameObject);
                }
            }


            // contador.bodynum = 0;
            if (contador.saber == 0)
            {
                FalconUnity.applyForceToShape(bodyId, new Vector3(0, -1.5f, 0), new Vector3(0, 0, 0));
            }
            if (contador.borrar == 1 || contador.ganador_consultorio == 1)
            {
                FalconUnity.removeDynamicShape(bodyId);
                contador.borrar = 0;
                Destroy(gameObject);
            }
        }
        else
        {
            bool res = FalconUnity.getDynamicShapePose(bodyId, out pos, out orient);
            if (!res)
            {
                //			Debug.Log("Error getting object pose");
                return;
            }
            transform.localPosition = pos;
            transform.localRotation = orient;
            FalconUnity.updateDynamicShape(bodyId, mass, k, linearFactors, angularFactors, friction);
        }
    }