//接收参数,剪切保留某一曲线上在某时间端内的轨迹 public void ClipTrailWithinTime(int sFrame, int eFrame) { if (curMotion == null) { return; } for (int i = 0; i < curMotion.size(); ++i) { curMotion.getTraj(i).clip(sFrame, eFrame); } }
void draw() { CreateLineMaterial(); // Apply the line material lineMaterial.SetPass(0); for (int i = 0; i < motion.size(); ++i) { if (motion.getTraj(i).getActive() == true) { drawCurve(motion.getTraj(i)); } } }
// Use this for initialization void OnEnable() { motion = TrailCurveDrawCtrl.Instance().curMotion; //isPlay = TrailCurveDrawCtrl.Instance().getIsPlay(); length = TrailCurveDrawCtrl.Instance().curve_length; start_index = 0; end_index = (int)motion.getTraj(cur_traj).size(); for (int i = 0; i < motion.size(); ++i) { initLineRenderer(i, Color.red, Color.red, 0.04f, 0.04f); } /*残影部分gameobject初始化 * root1 = GameObject.Find("GameObject1"); * root2 = GameObject.Find("GameObject2"); * hand1 = root1.transform.Find("lefthand").gameObject; **/ }
void drawCurve() { for (int traj = 0; traj < motion.size(); ++traj) { if (motion.getTraj(traj).getActive() == true) { lineRenderer[traj].positionCount = end_index - start_index; Vec3 temp = new Vec3(); for (int pos = start_index; pos < end_index; ++pos) { temp = motion.getTraj(traj).vec[pos].position; lineRenderer[traj].SetPosition(pos - start_index, new Vector3(temp.x, temp.y, temp.z)); } } else { lineRenderer[traj].positionCount = 0; } } //drawGhost(); }