Пример #1
0
    // Use this for initialization
    void Start()
    {
        beatingHeartParameters = BeatingScriptObject.GetComponent<beatingHeart>();
        perisacColliderHolder = GameObject.Find("Perisac_collider_holder");
        sphCollider = perisacColliderHolder.GetComponent<SphereCollider>();

        //sphCollider = GetComponent<SphereCollider>();
        initialSphereColliderRadius = sphCollider.radius;
    }
Пример #2
0
    void Start()
    {
        StiffnessCoeffecient = 0.0f;
                DampringCoeffecient = 0.0f;
                DisplacementStepSize = 0.001f;
                HeartAmplitudeRate = 0.0f;
                maxperupdate_count = 0;
                minperupdate_count = 0;
                set_heartrate = false;
                maxheartper = 0;
                minheartper = 0;
                firsttimecollision = true;
                dampingforce = true;
                other_parameters = BeatingScriptObject.GetComponent<beatingHeart>();
                heartper = other_parameters.per;
                GetComponent<Rigidbody>().constraints = RigidbodyConstraints.FreezePosition | RigidbodyConstraints.FreezeRotation;
                freeFormDeformation = BeatingScriptObject.GetComponent<ffd>();

                startx = transform.position.x;
                starty = transform.position.y;
                startz = transform.position.z;
        /*
                Debug.Log("Unity Starting coordinates");
                position.Set((float)startx,(float)starty,(float)startz);
                Debug.Log(position);
        */
                running = init();
                    if(running == 0)
                        Debug.Log("Device Initialized");

                hapticoriginx = getX();
                hapticoriginy = getY();
                hapticoriginz = getZ();
        /*
                Debug.Log("Haptic Starting coordinates");
                hapticorigin.Set((float)hapticoriginx,(float)hapticoriginy,(float)hapticoriginz);
                Debug.Log(hapticorigin);
        */
                position.Set((float)hapticoriginx,(float)hapticoriginy,(float)hapticoriginz);
                GetComponent<Rigidbody>().MovePosition(position);

                getTransform(tr);

                initialquaternion = matrixToQuaternion(tr);
                initialangles = FromQ2 (initialquaternion);

                //rigidbody.MoveRotation( Quaternion.Euler((float)initialangles.y,(float)initialangles.x,(float)initialangles.z));
                //rigidbody.MoveRotation(initialquaternion);

                initialanglex =  transform.eulerAngles.x;
                initialangley =  transform.eulerAngles.y;
                initialanglez =  transform.eulerAngles.z;

                Debug.Log("Euler Angles:  " +initialanglex +" " +initialangley +" " +initialanglez);

                scaleanglex = initialangles.x - initialanglex;
                if(scaleanglex<0)
                    scaleanglex = scaleanglex + 360;
                scaleangley = initialangles.y - initialangley;
                if(scaleangley<0)
                    scaleangley = scaleangley + 360;
                scaleanglez = initialangles.z - initialanglez;
                if(scaleanglez<0)
                    scaleanglez = scaleanglez + 360;

                Debug.Log("Initial Angles From Quat:  " +initialangles.x +" " +initialangles.y +" " +initialangles.z);
    }