示例#1
0
        /**
         * <summary>
         * Takes the atttibutes of the provided TuioContainer
         * and assigs these values to this TuioContainer.
         * The TuioTime time stamp of this TuioContainer remains unchanged.</summary>
         *
         * <param name="tcon">the TuioContainer to assign</param>
         */
        public void update(TuioContainer tcon)
        {
            base.update(tcon.X, tcon.Y);

            x_speed      = tcon.XSpeed;
            y_speed      = tcon.YSpeed;
            motion_speed = (float)Math.Sqrt(x_speed * x_speed + y_speed * y_speed);
            motion_accel = tcon.MotionAccel;

            if (motion_accel > 0)
            {
                state = TUIO_ACCELERATING;
            }
            else if (motion_accel < 0)
            {
                state = TUIO_DECELERATING;
            }
            else
            {
                state = TUIO_STOPPED;
            }

            lock (path) {
                path.AddLast(new TuioPoint(currentTime, xpos, ypos));
                if (path.Count > 128)
                {
                    path.RemoveFirst();
                }
            }
        }
示例#2
0
 /**
  * Custom heightmap update
  *
  */
 public void update(TuioContainer tcon, float _x, float _y, int _width, int _height, List <float> _heightPoints)
 {
     base.update(tcon.getX(), tcon.getY());
     heightPoints = _heightPoints;
     width        = _width;
     height       = _height;
     hxPos        = _x;
     hyPos        = _y;
     x_speed      = tcon.getXSpeed();
     y_speed      = tcon.getYSpeed();
     motion_speed = (float)Math.Sqrt(x_speed * x_speed + y_speed * y_speed);
     motion_accel = tcon.getMotionAccel();
     path.Add(new TuioPoint(currentTime, xpos, ypos));
     if (motion_accel > 0)
     {
         state = TUIO_ACCELERATING;
     }
     else if (motion_accel < 0)
     {
         state = TUIO_DECELERATING;
     }
     else
     {
         state = TUIO_STOPPED;
     }
 }
 /**
  * This constructor takes the atttibutes of the provided TuioContainer
  * and assigs these values to the newly created TuioContainer.
  *
  * @param	tcon	the TuioContainer to assign
  */
 public TuioContainer(TuioContainer tcon) : base(tcon)
 {
     session_id   = tcon.getSessionID();
     x_speed      = 0.0f;
     y_speed      = 0.0f;
     motion_speed = 0.0f;
     motion_accel = 0.0f;
     path         = new List <TuioPoint>();
     path.Add(new TuioPoint(currentTime, xpos, ypos));
     state = TUIO_ADDED;
 }
示例#4
0
 public TuioContainer(TuioContainer c)
     : base(c)
 {
     this.session_id = getSessionID();
     this.x_speed = 0.0f;
     this.y_speed = 0.0f;
     this.motion_speed = 0.0f;
     this.motion_accel = 0.0f;
     path = new List<TuioPoint>();
     path.Add(new TuioPoint(c.getX(),c.getY()));
     state = TUIO_ADDED;
 }
    public virtual void AddPlayer(TUIO.TuioContainer theTuioContainer)
    {
//		Vector2 position = UnityTuioManager.GetScreenPositionFromRelativePosition (theTuioContainer.Position);
        Vector2         position = TrackingAdapter.GetScreenPositionFromRelativePosition(theTuioContainer.Position.X, theTuioContainer.Position.Y);
        ATrackingEntity aPlayer  = (GameObject.Instantiate(_playerPrefab, new Vector3(position.x, position.y, 0), Quaternion.identity) as GameObject).GetComponent <ATrackingEntity>();

        aPlayer.TrackID          = theTuioContainer.SessionID;
        aPlayer.RelativePosition = new Vector2(theTuioContainer.Position.X, theTuioContainer.Position.Y);

        aPlayer.gameObject.name = string.Format("TuioPlayer_{0}", aPlayer.TrackID);

        _playerList.Add(aPlayer);
    }
示例#6
0
    public virtual void UpdatePlayerPosition(TUIO.TuioContainer theTuioContainer)
    {
        foreach (ATrackingEntity player in _playerList)
        {
            if (player.TrackID.Equals(theTuioContainer.SessionID))
            {
//				Vector2 position = UnityTuioManager.GetScreenPositionFromRelativePosition (theTuioContainer.Position);
                Vector2 position = TrackingAdapter.GetScreenPositionFromRelativePosition(theTuioContainer.Position.X, theTuioContainer.Position.Y);
                player.SetPosition(position);
                player.RelativePosition = new Vector2(theTuioContainer.Position.X, theTuioContainer.Position.Y);
                return;
            }
        }

        if (_addUnknownPlayerOnUpdate)
        {
            AddPlayer(theTuioContainer);
        }
    }
        /**
         * Takes the atttibutes of the provided TuioContainer
         * and assigs these values to this TuioContainer.
         * The TuioTime time stamp of this TuioContainer remains unchanged.
         *
         * @param	tcon	the TuioContainer to assign
         */
        public void update(TuioContainer tcon)
        {
            base.update(tcon.getX(), tcon.getY());

            x_speed      = tcon.getXSpeed();
            y_speed      = tcon.getYSpeed();
            motion_speed = (float)Math.Sqrt(x_speed * x_speed + y_speed * y_speed);
            motion_accel = tcon.getMotionAccel();
            path.Add(new TuioPoint(currentTime, xpos, ypos));
            if (motion_accel > 0)
            {
                state = TUIO_ACCELERATING;
            }
            else if (motion_accel < 0)
            {
                state = TUIO_DECELERATING;
            }
            else
            {
                state = TUIO_STOPPED;
            }
        }
示例#8
0
        /**
         * <summary>
         * Takes the atttibutes of the provided TuioContainer
         * and assigs these values to this TuioContainer.
         * The TuioTime time stamp of this TuioContainer remains unchanged.</summary>
         *
         * <param name="tcon">the TuioContainer to assign</param>
         */
        public void update(TuioContainer tcon)
        {
            base.update(tcon.X, tcon.Y);

            x_speed = tcon.XSpeed;
            y_speed = tcon.YSpeed;
            motion_speed = (float)Math.Sqrt(x_speed * x_speed + y_speed * y_speed);
            motion_accel = tcon.MotionAccel;
            path.Add(new TuioPoint(currentTime, xpos, ypos));
            if (motion_accel > 0) state = TUIO_ACCELERATING;
            else if (motion_accel < 0) state = TUIO_DECELERATING;
            else state = TUIO_STOPPED;
        }
示例#9
0
 /**
  * <summary>
  * This constructor takes the atttibutes of the provided TuioContainer
  * and assigs these values to the newly created TuioContainer.</summary>
  *
  * <param name="tcon">the TuioContainer to assign</param>
  */
 public TuioContainer(TuioContainer tcon)
     : base(tcon)
 {
     session_id = tcon.SessionID;
     x_speed = 0.0f;
     y_speed = 0.0f;
     motion_speed = 0.0f;
     motion_accel = 0.0f;
     path = new List<TuioPoint>();
     path.Add(new TuioPoint(currentTime, xpos, ypos));
     state = TUIO_ADDED;
 }
示例#10
0
        public void update(TuioContainer c)
        {
            base.update(c.getX(),c.getY());

            this.x_speed = c.getXSpeed();
            this.y_speed = c.getYSpeed();
            this.motion_speed = (float)Math.Sqrt(x_speed*x_speed+y_speed*y_speed);
            this.motion_accel = c.getMotionAccel();
            path.Add(new TuioPoint(xpos,ypos));
            state = UPDATED;
            timestamp = UNDEFINED;
        }
        /**
         * Takes the atttibutes of the provided TuioContainer
         * and assigs these values to this TuioContainer.
         * The TuioTime time stamp of this TuioContainer remains unchanged.
         *
         * @param	tcon	the TuioContainer to assign
         */
        public void update(TuioContainer tcon)
        {
            lastPoint = path[path.Count - 1];
            if (path.Count > 1)
                lastLastPoint = path[path.Count - 2];

            base.update(tcon.getX(), tcon.getY());

            x_speed = tcon.getXSpeed();
            y_speed = tcon.getYSpeed();
            motion_speed = (float)Math.Sqrt(x_speed * x_speed + y_speed * y_speed);
            motion_accel = tcon.getMotionAccel();
            lock (pathSync)
            {
                path.Add(new TuioPoint(currentTime, xpos, ypos));
            }
            if (motion_accel > 0) state = TUIO_ACCELERATING;
            else if (motion_accel < 0) state = TUIO_DECELERATING;
            else state = TUIO_STOPPED;
            this.trimPath();
        }
示例#12
0
 /**
  * Custom heightmap update
  *
  */
 public void update(TuioContainer tcon, float _x, float _y, int _width, int _height, List<float> _heightPoints)
 {
     base.update(tcon.getX(),tcon.getY());
     heightPoints = _heightPoints;
     width = _width;
     height = _height;
     hxPos = _x;
     hyPos = _y;
     x_speed = tcon.getXSpeed();
     y_speed = tcon.getYSpeed();
     motion_speed = (float)Math.Sqrt(x_speed*x_speed+y_speed*y_speed);
     motion_accel = tcon.getMotionAccel();
     path.Add(new TuioPoint(currentTime,xpos,ypos));
     if (motion_accel>0) state = TUIO_ACCELERATING;
     else if (motion_accel<0) state = TUIO_DECELERATING;
     else state = TUIO_STOPPED;
 }
示例#13
0
 /**
  * Takes the atttibutes of the provided TuioContainer
  * and assigs these values to this TuioContainer.
  * The TuioTime time stamp of this TuioContainer remains unchanged.
  *
  * @param	tcon	the TuioContainer to assign
  * @param	cntr	the Contour List to assign
  */
 public void update(TuioContainer tcon, List<TuioPoint> cntr)
 {
     base.update(tcon.getX(),tcon.getY());
     contour = cntr;
     x_speed = tcon.getXSpeed();
     y_speed = tcon.getYSpeed();
     motion_speed = (float)Math.Sqrt(x_speed*x_speed+y_speed*y_speed);
     motion_accel = tcon.getMotionAccel();
     path.Add(new TuioPoint(currentTime,xpos,ypos));
     if (motion_accel>0) state = TUIO_ACCELERATING;
     else if (motion_accel<0) state = TUIO_DECELERATING;
     else state = TUIO_STOPPED;
 }