|
@@ -128,8 +128,19 @@ public class Visualizer_FadeInSeries : MonoBehaviour
|
|
|
jointObj.transform.position = new Vector3(jointsDataSeries[i].jointsPositionsX[(int)jt], jointsDataSeries[i].jointsPositionsY[(int)jt], jointsDataSeries[i].jointsPositionsZ[(int)jt]);
|
|
|
jointObj.transform.parent = body.transform;
|
|
|
|
|
|
+ // Don't show joint if current and previous are almost the same position
|
|
|
+ if (i > 0)
|
|
|
+ {
|
|
|
+ Vector3 prev = new Vector3(jointsDataSeries[i - 1].jointsPositionsX[(int)jt], jointsDataSeries[i - 1].jointsPositionsY[(int)jt], jointsDataSeries[i - 1].jointsPositionsZ[(int)jt]);
|
|
|
+ float distance = (jointObj.transform.position - prev).magnitude;
|
|
|
+ if (distance < 0.05f)
|
|
|
+ {
|
|
|
+ jointObj.SetActive(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// Set alpha depends on i
|
|
|
- Color newColor = new Color(0.8f, 1, 0, Mathf.Lerp(0, 1, (float) (i + 1) / jointsDataSeries.Count));
|
|
|
+ Color newColor = new Color(0.8f, 1, 0, Mathf.Lerp(0, 1, (float)(i + 1) / jointsDataSeries.Count));
|
|
|
jointObj.GetComponent<MeshRenderer>().material.color = newColor;
|
|
|
jointObj.GetComponent<LineRenderer>().startColor = newColor;
|
|
|
jointObj.GetComponent<LineRenderer>().endColor = newColor;
|
|
@@ -154,7 +165,7 @@ public class Visualizer_FadeInSeries : MonoBehaviour
|
|
|
Transform jointObj = body.transform.Find(jt.ToString());
|
|
|
Transform targetJoint = body.transform.Find(_BoneMap[jt].ToString());
|
|
|
LineRenderer lr = jointObj.GetComponent<LineRenderer>();
|
|
|
-
|
|
|
+
|
|
|
lr.SetPosition(0, jointObj.localPosition);
|
|
|
lr.SetPosition(1, targetJoint.localPosition);
|
|
|
}
|