/// <summary>
        /// Updates Feature values
        /// </summary>
        /// <returns></returns>
        public object UpdateFeature()
        {
            if (m_PositionExtracted == null)
            {
                m_PositionExtracted = new IMLVector3();
            }


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

            if (gameObjRef == null)
            {
                // If the gameobject is null, we throw an error on the editor console
                Debug.LogWarning("GameObject missing in Extract Position Node!");
            }
            else
            {
                // Set values of our feature extracted
                if (LocalSpace)
                {
                    m_PositionExtracted.SetValues(gameObjRef.transform.localPosition);
                }
                else
                {
                    m_PositionExtracted.SetValues(gameObjRef.transform.position);
                }
            }

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

            if (m_v3Extracted == null)
            {
                m_v3Extracted = new IMLVector3();
            }
        }
 // Use this for initialization
 protected override void Init()
 {
     base.Init();
     tooltips = IMLTooltipsSerialization.LoadTooltip("Rotation");
     if (m_RotationExtracted == null)
     {
         m_RotationExtracted = new IMLVector3();
     }
 }
        // Use this for initialization
        protected override void Init()
        {
            counter = 0;
            count   = 5;

            base.Init();
            tooltips = IMLTooltipsSerialization.LoadTooltip("Position");
            if (m_PositionExtracted == null)
            {
                m_PositionExtracted = new IMLVector3();
            }
        }
Exemple #5
0
        /// <summary>
        /// Updates Feature values
        /// </summary>
        /// <returns></returns>
        public object UpdateFeature()
        {
            Vector3 valueToOutput = GetInputValue <Vector3>("inputVector3", this.inputVector3);

            if (m_v3Extracted == null)
            {
                m_v3Extracted = new IMLVector3();
            }

            m_v3Extracted.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];
            }

            counter++;

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

            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.localEulerAngles);
                }
                else
                {
                    m_RotationExtracted.SetValues(gameObjRef.transform.eulerAngles);
                }

                GameObjInputMissing = false;
            }

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

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

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

            return(this);
        }