示例#1
0
        /// <summary>
        /// Updates Feature values
        /// </summary>
        /// <returns></returns>
        public object UpdateFeature()
        {
            if (m_RotationExtracted == null)
            {
                m_RotationExtracted = new IMLVector4();
            }

            var gameObjRef = GetInputValue <GameObject>("gameObjectIntoNode", this.gameObjectIntoNode);

            if (gameObjRef == null)
            {
                if ((graph as IMLController).IsGraphRunning)
                {
                    // If the gameobject is null, we throw an error on the editor console
                    Debug.LogWarning("GameObject missing in Extract Rotation Node!");
                }
                GameObjInputMissing = true;
            }
            else
            {
                // Set values of our feature extracted
                if (LocalSpace)
                {
                    m_RotationExtracted.SetValues(gameObjRef.transform.localRotation);
                }
                else
                {
                    m_RotationExtracted.SetValues(gameObjRef.transform.rotation);
                }

                GameObjInputMissing = false;
            }

            return(this);
        }
示例#2
0
        // Use this for initialization
        protected override void Init()
        {
            base.Init();

            if (m_v4Extracted == null)
            {
                m_v4Extracted = new IMLVector4();
            }
        }
 // Use this for initialization
 protected override void Init()
 {
     base.Init();
     tooltips = IMLTooltipsSerialization.LoadTooltip("Rotation");
     if (m_RotationExtracted == null)
     {
         m_RotationExtracted = new IMLVector4();
     }
 }
示例#4
0
        /// <summary>
        /// Updates Feature values
        /// </summary>
        /// <returns></returns>
        public object UpdateFeature()
        {
            Vector4 valueToOutput = GetInputValue <Vector4>("inputVector4", this.inputVector4);

            if (m_v4Extracted == null)
            {
                m_v4Extracted = new IMLVector4();
            }

            m_v4Extracted.SetValues(valueToOutput);

            return(this);
        }
        /// <summary>
        /// Updates Feature values
        /// </summary>
        /// <returns></returns>
        public object UpdateFeature()
        {
            //check if receiving data
            if (counter == count)
            {
                counter = 0;
                if (x == FeatureValues.Values[0] && y == FeatureValues.Values[1] && z == FeatureValues.Values[2])
                {
                    ReceivingData = false;
                }
                else
                {
                    ReceivingData = true;
                }
                x = FeatureValues.Values[0];
                y = FeatureValues.Values[1];
                z = FeatureValues.Values[2];
                w = FeatureValues.Values[3];
            }

            counter++;

            if (m_RotationExtracted == null)
            {
                m_RotationExtracted = new IMLVector4();
            }

            var gameObjRef = GetInputValue <GameObject>("GameObjectDataIn", this.GameObjectDataIn);

            if (gameObjRef == null)
            {
                if ((graph as IMLController).IsGraphRunning)
                {
                    // If the gameobject is null, we throw an error on the editor console
                    //Debug.LogWarning("GameObject missing in Extract Rotation Node!");
                }
                GameObjInputMissing = true;
            }
            else
            {
                // Set values of our feature extracted
                if (LocalSpace)
                {
                    m_RotationExtracted.SetValues(gameObjRef.transform.localRotation);
                }
                else
                {
                    m_RotationExtracted.SetValues(gameObjRef.transform.rotation);
                }

                GameObjInputMissing = false;
            }

            if (!x_switch)
            {
                FeatureValues.Values[0] = 0;
            }

            if (!y_switch)
            {
                FeatureValues.Values[1] = 0;
            }

            if (!z_switch)
            {
                FeatureValues.Values[2] = 0;
            }

            if (!w_switch)
            {
                FeatureValues.Values[3] = 0;
            }

            return(this);
        }