Exemplo n.º 1
0
    void startTrace(RaycastHit h, Touch t, bool hasHit)
    {
        Vector3?   start = hasHit ? (Vector3?)h.point : null;
        TouchTrace tr    = new TouchTrace(Time.time, start);

        liveTraces.Add(t.fingerId, tr);
    }
Exemplo n.º 2
0
    void drawTrace(TouchTrace tr, TraceConfig config)
    {
        if (tr.startPos != null)
        {
            Gizmos.color = config.StartColor;
            Gizmos.DrawSphere(tr.startPos.Value, config.SphereSize);
        }

        if (tr.endPos != null)
        {
            Gizmos.color = config.EndColor;
            Gizmos.DrawSphere(tr.endPos.Value, config.SphereSize);
        }

        Gizmos.color = config.PathColor;
        Vector3?fromPos = null;

        foreach (Vector3 pos in tr.positions)
        {
            if (fromPos == null)
            {
                fromPos = (Vector3?)tr.startPos;
            }
            if (fromPos != null)
            {
                Gizmos.DrawLine(fromPos.Value, pos);
            }
            fromPos = (Vector3?)pos;
        }
    }
Exemplo n.º 3
0
    void updateTrace(RaycastHit h, Touch t)
    {
        if (!liveTraces.ContainsKey(t.fingerId))
        {
            return;
        }

        TouchTrace tr = liveTraces[t.fingerId];

        tr.positions.Add(h.point);
    }
Exemplo n.º 4
0
    void endTrace(RaycastHit h, Touch t, bool hasHit)
    {
        if (!liveTraces.ContainsKey(t.fingerId))
        {
            return;
        }

        TouchTrace tr = liveTraces[t.fingerId];

        tr.endTime = Time.time;
        if (hasHit)
        {
            tr.endPos = (Vector3?)h.point;
        }

        oldTraces.Add(tr);
        liveTraces.Remove(t.fingerId);
    }
Exemplo n.º 5
0
	void drawTrace(TouchTrace tr, TraceConfig config)
	{ 
		if (tr.startPos != null)
		{
			Gizmos.color = config.StartColor;
			Gizmos.DrawSphere(tr.startPos.Value, config.SphereSize);
		}
		
		if (tr.endPos != null)
		{
			Gizmos.color = config.EndColor;
			Gizmos.DrawSphere(tr.endPos.Value, config.SphereSize);
		}
		
		Gizmos.color = config.PathColor;
		Vector3? fromPos = null;
		foreach (Vector3 pos in tr.positions)
		{
			if (fromPos == null) fromPos = (Vector3?)tr.startPos;
			if (fromPos != null) Gizmos.DrawLine(fromPos.Value, pos);
			fromPos = (Vector3?)pos;
		}
	}
Exemplo n.º 6
0
	void startTrace(RaycastHit h, Touch t, bool hasHit)
	{
		Vector3? start = hasHit ? (Vector3?)h.point : null;
		TouchTrace tr = new TouchTrace(Time.time, start);
		liveTraces.Add(t.fingerId, tr);
	}