Beispiel #1
0
    void Update()
    {
        if (m_Init == true)
        {
            // Multiply by scale value only if used
            if (UsePositionScale)
            {
                // Position
                if (UsePositionX)
                {
                    m_DestinationVirtualTracker.SetX(PositionScaleValue * m_SourceTracker.GetX());
                }
                // Inverting Unity Y and MiddleVR Z because of different coordinate systems
                if (UsePositionY)
                {
                    m_DestinationVirtualTracker.SetZ(PositionScaleValue * m_SourceTracker.GetZ());
                }
                // Inverting Unity Y and MiddleVR Z because of different coordinate systems
                if (UsePositionZ)
                {
                    m_DestinationVirtualTracker.SetY(PositionScaleValue * m_SourceTracker.GetY());
                }
            }
            else
            {
                // Position
                if (UsePositionX)
                {
                    m_DestinationVirtualTracker.SetX(m_SourceTracker.GetX());
                }
                // Inverting Unity Y and MiddleVR Z because of different coordinate systems
                if (UsePositionY)
                {
                    m_DestinationVirtualTracker.SetZ(m_SourceTracker.GetZ());
                }
                // Inverting Unity Y and MiddleVR Z because of different coordinate systems
                if (UsePositionZ)
                {
                    m_DestinationVirtualTracker.SetY(m_SourceTracker.GetY());
                }
            }

            // Orientation
            if (UseYaw)
            {
                m_DestinationVirtualTracker.SetYaw(m_SourceTracker.GetYaw());
            }
            if (UsePitch)
            {
                m_DestinationVirtualTracker.SetPitch(m_SourceTracker.GetPitch());
            }
            if (UseRoll)
            {
                m_DestinationVirtualTracker.SetRoll(m_SourceTracker.GetRoll());
            }
        }
    }
Beispiel #2
0
    protected void Update()
    {
        if (m_IsInit)
        {
            float scale = 1.0f;

            if (UsePositionScale)
            {
                scale = PositionScaleValue;
            }

            // Position
            //
            // Show how coordinates values can be changed when feeding a virtual tracker.
            //
            if (UsePositionX)
            {
                m_DestinationVirtualTracker.SetX(scale * m_SourceTracker.GetX());
            }
            if (UsePositionY)
            {
                m_DestinationVirtualTracker.SetZ(scale * m_SourceTracker.GetZ());
            }
            if (UsePositionZ)
            {
                m_DestinationVirtualTracker.SetY(scale * m_SourceTracker.GetY());
            }

            // Orientation
            //
            // Note that it is suggested to use quaternions if you do not need
            // to decompose a rotation.
            //
            if (UseYaw)
            {
                m_DestinationVirtualTracker.SetYaw(m_SourceTracker.GetYaw());
            }
            if (UsePitch)
            {
                m_DestinationVirtualTracker.SetPitch(m_SourceTracker.GetPitch());
            }
            if (UseRoll)
            {
                m_DestinationVirtualTracker.SetRoll(m_SourceTracker.GetRoll());
            }
        }
    }