Пример #1
0
    /// <summary>
    /// Converts the given world-space transform to an OVRPose in tracking space.
    /// </summary>
    public static OVRPose ToTrackingSpacePose(this Transform transform, Camera camera)
    {
        OVRPose headPose;

        headPose.position    = InputTracking.GetLocalPosition(Node.Head);
        headPose.orientation = InputTracking.GetLocalRotation(Node.Head);

        var ret = headPose * transform.ToHeadSpacePose(camera);

        return(ret);
    }
Пример #2
0
        void UpdateCameraTransform()
        {
            if (!m_Camera)
            {
                return;
            }

#pragma warning disable 618
            var cameraTransform = m_Camera.transform;
            cameraTransform.localPosition = InputTracking.GetLocalPosition(XRNode.Head);
            cameraTransform.localRotation = InputTracking.GetLocalRotation(XRNode.Head);
#pragma warning restore 618
        }
Пример #3
0
        void UpdateCameraTransform()
        {
            if (!m_Camera)
            {
                return;
            }

            var cameraTransform = m_Camera.transform;

#if UNITY_2017_2_OR_NEWER
            cameraTransform.localPosition = InputTracking.GetLocalPosition(XRNode.Head);
            cameraTransform.localRotation = InputTracking.GetLocalRotation(XRNode.Head);
#endif
        }
Пример #4
0
    /// <summary>
    /// Converts the given pose from tracking-space to world-space.
    /// </summary>
    public static OVRPose ToWorldSpacePose(OVRPose trackingSpacePose)
    {
        OVRPose headPose;

        headPose.position    = InputTracking.GetLocalPosition(Node.Head);
        headPose.orientation = InputTracking.GetLocalRotation(Node.Head);

        // Transform from tracking-Space to head-Space
        OVRPose poseInHeadSpace = headPose.Inverse() * trackingSpacePose;

        // Transform from head space to world space
        OVRPose ret = Camera.main.transform.ToOVRPose() * poseInHeadSpace;

        return(ret);
    }
Пример #5
0
    protected virtual void UpdateAnchors()
    {
        EnsureGameObjectIntegrity();

        if (!Application.isPlaying)
        {
            return;
        }

        if (_skipUpdate)
        {
            centerEyeAnchor.FromOVRPose(OVRPose.identity, true);
            leftEyeAnchor.FromOVRPose(OVRPose.identity, true);
            rightEyeAnchor.FromOVRPose(OVRPose.identity, true);

            return;
        }

        bool monoscopic = OVRManager.instance.monoscopic;
        bool hmdPresent = OVRNodeStateProperties.IsHmdPresent();

        OVRPose tracker = OVRManager.tracker.GetPose();

        trackerAnchor.localRotation = tracker.orientation;

        Quaternion emulatedRotation = Quaternion.Euler(-OVRManager.instance.headPoseRelativeOffsetRotation.x, -OVRManager.instance.headPoseRelativeOffsetRotation.y, OVRManager.instance.headPoseRelativeOffsetRotation.z);

        centerEyeAnchor.localRotation = hmdPresent ? InputTracking.GetLocalRotation(Node.CenterEye) : emulatedRotation;
        leftEyeAnchor.localRotation   = (!hmdPresent || monoscopic) ? centerEyeAnchor.localRotation : InputTracking.GetLocalRotation(Node.LeftEye);
        rightEyeAnchor.localRotation  = (!hmdPresent || monoscopic) ? centerEyeAnchor.localRotation : InputTracking.GetLocalRotation(Node.RightEye);

        leftHandAnchor.localRotation  = InputTracking.GetLocalRotation(Node.LeftHand);
        rightHandAnchor.localRotation = InputTracking.GetLocalRotation(Node.RightHand);

        trackerAnchor.localPosition = tracker.position;

        centerEyeAnchor.localPosition = hmdPresent ? InputTracking.GetLocalPosition(Node.CenterEye) : OVRManager.instance.headPoseRelativeOffsetTranslation;
        leftEyeAnchor.localPosition   = (!hmdPresent || monoscopic) ? centerEyeAnchor.localPosition : InputTracking.GetLocalPosition(Node.LeftEye);
        rightEyeAnchor.localPosition  = (!hmdPresent || monoscopic) ? centerEyeAnchor.localPosition : InputTracking.GetLocalPosition(Node.RightEye);

        leftHandAnchor.localPosition  = InputTracking.GetLocalPosition(Node.LeftHand);
        rightHandAnchor.localPosition = InputTracking.GetLocalPosition(Node.RightHand);

        RaiseUpdatedAnchorsEvent();
    }
Пример #6
0
    protected virtual void UpdateAnchors()
    {
        //整合性の確保
        EnsureGameObjectIntegrity();

        if (!Application.isPlaying)
        {
            return;
        }

        if (_skipUpdate)
        {
            centerEyeAnchor.FromOVRPose(OVRPose.identity, true);
            leftEyeAnchor.FromOVRPose(OVRPose.identity, true);
            rightEyeAnchor.FromOVRPose(OVRPose.identity, true);

            return;
        }

        bool monoscopic = OVRManager.instance.monoscopic;

        OVRPose tracker = OVRManager.tracker.GetPose();

        trackerAnchor.localRotation = tracker.orientation;

        centerEyeAnchor.localRotation = InputTracking.GetLocalRotation(Node.CenterEye);
        leftEyeAnchor.localRotation   = monoscopic ? centerEyeAnchor.localRotation : InputTracking.GetLocalRotation(Node.LeftEye);
        rightEyeAnchor.localRotation  = monoscopic ? centerEyeAnchor.localRotation : InputTracking.GetLocalRotation(Node.RightEye);

        leftHandAnchor.localRotation  = InputTracking.GetLocalRotation(Node.LeftHand);
        rightHandAnchor.localRotation = InputTracking.GetLocalRotation(Node.RightHand);

        trackerAnchor.localPosition = tracker.position;

        centerEyeAnchor.localPosition = InputTracking.GetLocalPosition(Node.CenterEye);
        leftEyeAnchor.localPosition   = monoscopic ? centerEyeAnchor.localPosition : InputTracking.GetLocalPosition(Node.LeftEye);
        rightEyeAnchor.localPosition  = monoscopic ? centerEyeAnchor.localPosition : InputTracking.GetLocalPosition(Node.RightEye);

        leftHandAnchor.localPosition  = InputTracking.GetLocalPosition(Node.LeftHand);
        rightHandAnchor.localPosition = InputTracking.GetLocalPosition(Node.RightHand);

        RaiseUpdatedAnchorsEvent();
    }
Пример #7
0
    // Takes care of the local hand tracking
    void HandTracking()
    {
        leftPivot.localRotation = InputTracking.GetLocalRotation(Node.LeftHand);
        leftPivot.localPosition = InputTracking.GetLocalPosition(Node.LeftHand);

        rightPivot.localRotation = InputTracking.GetLocalRotation(Node.RightHand);
        rightPivot.localPosition = InputTracking.GetLocalPosition(Node.RightHand);

        headPivot.position = centerPivot.position;
        headPivot.rotation = centerPivot.rotation;

        var duration = handAnimationL["Hand Close"].length;

        handTimeL = Mathf.Clamp(duration * OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger), 0f, duration - .1f);
        handTimeR = Mathf.Clamp(duration * OVRInput.Get(OVRInput.Axis1D.SecondaryHandTrigger), 0f, duration - .1f);

        isFistL = (OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger) >= .75f);
        isFistR = (OVRInput.Get(OVRInput.Axis1D.SecondaryHandTrigger) >= .75f);
    }
    // Update is called once per frame
    void Update()
    {
        if (!listening && Input.GetMouseButtonDown(0))
        {
            listening = true;
        }
                #if UNITY_EDITOR
        if (listening)
        {
            Cursor.lockState = CursorLockMode.Locked;
            x += (Input.GetAxis("Mouse X") * _turnRate * Time.deltaTime);
            y -= (Input.GetAxis("Mouse Y") * _turnRate * Time.deltaTime);
            Quaternion rotation = Quaternion.Euler(y, x, 0f);
//			transform.position = rotation * transform.position;
            transform.rotation = rotation;
        }
                #else
        transform.localRotation = XRInput.GetLocalRotation(XRNode.CenterEye);
        Debug.Log(XRInput.GetLocalRotation(XRNode.CenterEye));
                #endif
    }
    public virtual Matrix4x4 ComputeTrackReferenceMatrix()
    {
        if (centerEyeAnchor == null)
        {
            Debug.LogError("centerEyeAnchor is required");
            return(Matrix4x4.identity);
        }

        // The ideal approach would be using UnityEngine.VR.VRNode.TrackingReference, then we would not have to depend on the OVRCameraRig. Unfortunately, it is not available in Unity 5.4.3

        OVRPose headPose;

        headPose.position    = InputTracking.GetLocalPosition(Node.Head);
        headPose.orientation = InputTracking.GetLocalRotation(Node.Head);

        OVRPose   invHeadPose   = headPose.Inverse();
        Matrix4x4 invHeadMatrix = Matrix4x4.TRS(invHeadPose.position, invHeadPose.orientation, Vector3.one);

        Matrix4x4 ret = centerEyeAnchor.localToWorldMatrix * invHeadMatrix;

        return(ret);
    }
Пример #10
0
    // Update is called once per frame
    void Update()
    {
        //if (!isLocalPlayer)
        //{
        //	Destroy(ovrCamRig);
        //	AssignRemoteLayer();
        //}
        //else
        //{
        //keep camera good when another player joins
        //if (leftEye.tag != "MainCamera")
        //{
        //	leftEye.tag = "MainCamera";
        //	leftEye.enabled = true;
        //}
        //if (rightEye.tag != "MainCamera")
        //{
        //	rightEye.tag = "MainCamera";
        //	rightEye.enabled = true;
        //}

        //keep hand positions good when another player joins
        leftHand.localRotation  = InputTracking.GetLocalRotation(Node.LeftHand);
        rightHand.localRotation = InputTracking.GetLocalRotation(Node.RightHand);
        leftHand.localPosition  = InputTracking.GetLocalPosition(Node.LeftHand);
        rightHand.localPosition = InputTracking.GetLocalPosition(Node.RightHand);

        //handle position and rotation of the player
        Vector2 primaryAxis = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);

        ////(triggers walking sound and animation)
        if (primaryAxis.y != 0f || Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.E) || Input.GetKey(KeyCode.Q))
        {
            animator.SetBool("isWalking", true);
        }
        else
        {
            animator.SetBool("isWalking", false);
        }

        //update pos every frame (seems to slow PC a bit)
        pos = transform.position;


        _isGrounded = Physics.CheckSphere(_groundChecker.position, GroundDistance, Ground, QueryTriggerInteraction.Ignore);

        if (_isGrounded)
        {
            if (airBorn)
            {
                SoundManager.Instance.PlayOneShot(SoundManager.Instance.landingBoom);
            }

            airBorn = false;
            Debug.Log("Currently Grounded");
        }
        if (!_isGrounded)
        {
            airBorn = true;
            Debug.Log("The Mech is NOT Currently Grounded!!!");
            pos += (Physics.gravity * 0.7f);
        }


        if (Input.GetButtonDown("Jump") && _isGrounded)
        {
            airBorn = true;
            //_body.AddForce(Vector3.up * Mathf.Sqrt(JumpHeight * Physics.gravity.y), ForceMode.VelocityChange);
        }

        //if speedboost triggered...
        if (speedBoosted == true)
        {
            //go fast
            currentSpeed = BoostSpeed;
        }
        else
        {
            //go regular speed
            currentSpeed = speed;
        }

        if (primaryAxis.y > 0f || Input.GetKey(KeyCode.W))
        {
            //animator.SetBool("isWalking", true);

            if (primaryAxis.y > 0f)
            {
                pos += (primaryAxis.y * transform.forward * Time.deltaTime * currentSpeed);
            }
            if (Input.GetKey(KeyCode.W))
            {
                pos += (transform.forward * Time.deltaTime * currentSpeed);
            }
        }
        else if (primaryAxis.y < 0f || Input.GetKey(KeyCode.S))
        {
            animator.SetBool("isWalkBack", true);

            if (primaryAxis.y < 0f)
            {
                pos += (Mathf.Abs(primaryAxis.y) * -transform.forward * Time.deltaTime * currentSpeed);
            }
            if (Input.GetKey(KeyCode.S))
            {
                pos += (-transform.forward * Time.deltaTime * currentSpeed);
            }
        }
        else
        {
            animator.SetBool("isWalkBack", false);
        }

        if (primaryAxis.x > 0f || Input.GetKey(KeyCode.D))
        {
            //animator.SetBool("isWalking", true);

            if (primaryAxis.x > 0f)
            {
                pos += (Mathf.Abs(primaryAxis.x) * transform.right * Time.deltaTime * currentSpeed);
            }
            if (Input.GetKey(KeyCode.D))
            {
                pos += (transform.right * Time.deltaTime * currentSpeed);
            }
        }
        else if (primaryAxis.x < 0f || Input.GetKey(KeyCode.A))
        {
            //animator.SetBool("isWalking", true);

            if (primaryAxis.x < 0f)
            {
                pos += (Mathf.Abs(primaryAxis.x) * -transform.right * Time.deltaTime * currentSpeed);
            }
            if (Input.GetKey(KeyCode.A))
            {
                pos += (-transform.right * Time.deltaTime * currentSpeed);
            }
        }

        transform.position = pos;

        Vector3 euler         = transform.rotation.eulerAngles;
        Vector2 secondaryAxis = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);

        if (Input.GetKey(KeyCode.E))
        {
            euler.y += .5f;
        }

        if (Input.GetKey(KeyCode.Q))
        {
            euler.y -= .5f;
        }

        euler.y           += secondaryAxis.x;
        transform.rotation = Quaternion.Euler(euler);

        //maybe set local rotation too?
        //transform.localRotation = Quaternion.Euler(euler);

        //suicide kill test
        if (Input.GetKeyDown(KeyCode.K))
        {
            var healthScript = GetComponent <Health>();
            if (healthScript != null)
            {
                Debug.Log("Self Destruct Initiated");
                Debug.Log("Current Health is now " + healthScript.currentHealth);
                healthScript.RpcTakeDamage(100);
            }
        }
        //}
    }
    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            Destroy(ovrCamRig);
        }
        else
        {
            //Take care of camera transporting when players join.
            if (leftEye.tag != "MainCamera")
            {
                leftEye.tag     = "MainCamera";
                leftEye.enabled = true;
            }
            if (rightEye.tag != "MainCamera")
            {
                rightEye.tag     = "MainCamera";
                rightEye.enabled = true;
            }

            //handle animations
            if (OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).x != 0 || OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).y != 0)
            {
                //Set animatio to running over the server
                GetComponent <LocalAnimationControl>().CmdUpdateAnim("run");
                anim.SetBool("Idle", false);
            }
            else
            {
                //Set animation to nothing over the server.
                GetComponent <LocalAnimationControl>().CmdUpdateAnim("idle");
                anim.SetBool("Idle", true);
            }

            //Take care of hand position tracking
            leftHand.localRotation  = InputTracking.GetLocalRotation(Node.LeftHand);
            leftHand.localPosition  = InputTracking.GetLocalPosition(Node.LeftHand);
            rightHand.localRotation = InputTracking.GetLocalRotation(Node.RightHand);
            rightHand.localPosition = InputTracking.GetLocalPosition(Node.RightHand);

            //Handle position and rotation of player.
            Vector2 primaryAxis = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);

            if (primaryAxis.y > 0f)
            {
                pos += (primaryAxis.y * transform.forward * Time.deltaTime * speed);
            }
            if (primaryAxis.y < 0f)
            {
                pos += (Mathf.Abs(primaryAxis.y) * -transform.forward * Time.deltaTime * speed);
            }
            if (primaryAxis.x > 0f)
            {
                pos += (primaryAxis.x * transform.right * Time.deltaTime * speed);
            }
            if (primaryAxis.x < 0f)
            {
                pos += (Mathf.Abs(primaryAxis.x) * -transform.right * Time.deltaTime * speed);
            }

            transform.position = pos;

            Vector3 euler         = transform.rotation.eulerAngles;
            Vector2 secondaryAxis = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
            euler.y           += secondaryAxis.x;
            transform.rotation = Quaternion.Euler(euler);
            //Maybe set local rotation too?
            transform.localRotation = Quaternion.Euler(euler);
        }
    }
Пример #12
0
    protected virtual void UpdateAnchors()
    {
        EnsureGameObjectIntegrity();

        if (!Application.isPlaying)
        {
            return;
        }

        if (_skipUpdate)
        {
            centerEyeAnchor.FromOVRPose(OVRPose.identity, true);
            leftEyeAnchor.FromOVRPose(OVRPose.identity, true);
            rightEyeAnchor.FromOVRPose(OVRPose.identity, true);

            return;
        }

        bool monoscopic = OVRManager.instance.monoscopic;
        bool hmdPresent = OVRNodeStateProperties.IsHmdPresent();

        OVRPose tracker = OVRManager.tracker.GetPose();

        trackerAnchor.localRotation = tracker.orientation;

        Quaternion emulatedRotation = Quaternion.Euler(-OVRManager.instance.headPoseRelativeOffsetRotation.x, -OVRManager.instance.headPoseRelativeOffsetRotation.y, OVRManager.instance.headPoseRelativeOffsetRotation.z);

        centerEyeAnchor.localRotation = hmdPresent ? InputTracking.GetLocalRotation(Node.CenterEye) : emulatedRotation;
        leftEyeAnchor.localRotation   = (!hmdPresent || monoscopic) ? centerEyeAnchor.localRotation : InputTracking.GetLocalRotation(Node.LeftEye);
        rightEyeAnchor.localRotation  = (!hmdPresent || monoscopic) ? centerEyeAnchor.localRotation : InputTracking.GetLocalRotation(Node.RightEye);

        //Need this for controller offset because if we're on OpenVR, we want to set the local poses as specified by Unity, but if we're not, OVRInput local position is the right anchor
        if (OVRManager.loadedXRDevice == OVRManager.XRDevice.OpenVR)
        {
            leftHandAnchor.localPosition  = InputTracking.GetLocalPosition(Node.LeftHand);
            rightHandAnchor.localPosition = InputTracking.GetLocalPosition(Node.RightHand);
            leftHandAnchor.localRotation  = InputTracking.GetLocalRotation(Node.LeftHand);
            rightHandAnchor.localRotation = InputTracking.GetLocalRotation(Node.RightHand);
        }
        else
        {
            leftHandAnchor.localPosition  = OVRInput.GetLocalControllerPosition(OVRInput.Controller.LTouch);
            rightHandAnchor.localPosition = OVRInput.GetLocalControllerPosition(OVRInput.Controller.RTouch);
            leftHandAnchor.localRotation  = OVRInput.GetLocalControllerRotation(OVRInput.Controller.LTouch);
            rightHandAnchor.localRotation = OVRInput.GetLocalControllerRotation(OVRInput.Controller.RTouch);
        }

        trackerAnchor.localPosition = tracker.position;

        centerEyeAnchor.localPosition = hmdPresent ? InputTracking.GetLocalPosition(Node.CenterEye) : OVRManager.instance.headPoseRelativeOffsetTranslation;
        leftEyeAnchor.localPosition   = (!hmdPresent || monoscopic) ? centerEyeAnchor.localPosition : InputTracking.GetLocalPosition(Node.LeftEye);
        rightEyeAnchor.localPosition  = (!hmdPresent || monoscopic) ? centerEyeAnchor.localPosition : InputTracking.GetLocalPosition(Node.RightEye);

        OVRPose leftOffsetPose  = OVRPose.identity;
        OVRPose rightOffsetPose = OVRPose.identity;

        if (OVRManager.loadedXRDevice == OVRManager.XRDevice.OpenVR)
        {
            leftOffsetPose  = OVRManager.GetOpenVRControllerOffset(Node.LeftHand);
            rightOffsetPose = OVRManager.GetOpenVRControllerOffset(Node.RightHand);

            //Sets poses of left and right nodes, local to the tracking space.
            OVRManager.SetOpenVRLocalPose(trackingSpace.InverseTransformPoint(leftControllerAnchor.position),
                                          trackingSpace.InverseTransformPoint(rightControllerAnchor.position),
                                          Quaternion.Inverse(trackingSpace.rotation) * leftControllerAnchor.rotation,
                                          Quaternion.Inverse(trackingSpace.rotation) * rightControllerAnchor.rotation);
        }
        rightControllerAnchor.localPosition = rightOffsetPose.position;
        rightControllerAnchor.localRotation = rightOffsetPose.orientation;
        leftControllerAnchor.localPosition  = leftOffsetPose.position;
        leftControllerAnchor.localRotation  = leftOffsetPose.orientation;

        RaiseUpdatedAnchorsEvent();
    }
Пример #13
0
    // [Command]
    // public void CmdFireProjectile()
    // {
    //     if (NetworkServer.active)
    //     {
    //         prefabInstance = Instantiate(projectilePrefab, spawnPos.position, spawnPos.transform.rotation);
    //         prefabInstance.GetComponent<Rigidbody>().velocity = spawnPos.transform.forward * 2;
    //         NetworkServer.Spawn(prefabInstance);
    //     }
    // }
    // public void Fire(float fireRate)
    // {
    //     CmdFireProjectile();
    // }
    void Update()
    {
        if (!isLocalPlayer)
        {
            if (OvrCam != null)
            {
                Destroy(OvrCam);
            }
        }
        else
        {
            if (camL != null)
            {
                if (camL.tag != "MainCamera")
                {
                    camL.tag     = "MainCamera";
                    camL.enabled = true;
                }
                if (camR.tag != "MainCamera")
                {
                    camR.tag     = "MainCamera";
                    camR.enabled = true;
                }
            }

            // if (OVRInput.Get(OVRInput.Button.PrimaryHandTrigger))
            // {
            //     Fire(1);
            // }
            // if (OVRInput.Get(OVRInput.Button.Two))
            // {
            //     Fire(1);
            // }
            // if (OVRInput.Get(OVRInput.Button.Three))
            // {
            //     Fire(1);
            // }
            // if (OVRInput.Get(OVRInput.Button.Four))
            // {
            //     Fire(1);
            // }

            //handle animations
            if (OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).x != 0 || OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick).y != 0)
            {
                //anim.SetBool("Idle", false);
                //GetComponent<LocalAnimationControl>().CmdUpdateAnim("run");
            }
            else
            {
                //anim.SetBool("Idle", true);
                // GetComponent<LocalAnimationControl>().CmdUpdateAnim("idle");
            }

            //"hands" need to put in hand models and animations, but this is how to get the position:
            leftHandAnchor.localRotation  = InputTracking.GetLocalRotation(Node.LeftHand);
            rightHandAnchor.localRotation = InputTracking.GetLocalRotation(Node.RightHand);
            leftHandAnchor.localPosition  = InputTracking.GetLocalPosition(Node.LeftHand);
            rightHandAnchor.localPosition = InputTracking.GetLocalPosition(Node.RightHand);

            //If we want to pull from OVRinput
            Vector2 primaryAxis = OVRInput.Get(OVRInput.Axis2D.PrimaryThumbstick);

            if (primaryAxis.y > 0.0f)
            {
                pos += (primaryAxis.y * transform.forward * Time.deltaTime * speed);
            }

            if (primaryAxis.y < 0.0f)
            {
                pos += (Mathf.Abs(primaryAxis.y) * -transform.forward * Time.deltaTime * speed);
            }

            if (primaryAxis.x < 0.0f)
            {
                pos += (Mathf.Abs(primaryAxis.x) * -transform.right * Time.deltaTime * speed);
            }

            if (primaryAxis.x > 0.0f)
            {
                pos += (primaryAxis.x * transform.right * Time.deltaTime * speed);
            }

            transform.position = pos;

            Vector3 euler         = transform.rotation.eulerAngles;
            Vector2 secondaryAxis = OVRInput.Get(OVRInput.Axis2D.SecondaryThumbstick);
            euler.y                += secondaryAxis.x;
            transform.rotation      = Quaternion.Euler(euler);
            transform.localRotation = Quaternion.Euler(euler);
        }
    }