public Quaternion GetRotAt(float p) { if (shapePath != null) { PathVector pv = shapePath.getPathInfo(p); Quaternion rot = pv.rot; return(rot); } else { return(Quaternion.identity); } }
// Update is called once per frame void OnDrawGizmos() { if (points == null || points.Count < 1) { return; } // ShapePath pointList = new PointList(); // ShapePath if (pointList != null) { shapePath = pointList.GetShapePath(points.ToArray(), rots.ToArray()); for (int i = 0; i < num; i++) { float v = (float)i / num; Vector3 pt; // pt = shapePath.getPointInfoVec3Percent(v); PathVector pv = shapePath.getPathInfo(v); pt = new Vector3(pv.x, pv.y, pv.z); Gizmos.color = color; Gizmos.DrawWireSphere(pt, 0.25f); Quaternion rot = pv.rot; // Gizmos.color = new Color(0, 0, 0, 0.25f); Gizmos.DrawRay(pt, rot * Vector3.up * 2); Gizmos.DrawRay(pt, rot * Vector3.right * 2); Quaternion q2 = GetQuaternionAt(v); Gizmos.color = Color.green; Gizmos.DrawRay(pt, q2 * Vector3.up); Gizmos.color = Color.red; Gizmos.DrawRay(pt, q2 * Vector3.right); } } }
// Update is called once per frame void OnDrawGizmos() { if(points == null || points.Count < 1){ return; } // ShapePath pointList = new PointList(); // ShapePath if (pointList != null) { shapePath = pointList.GetShapePath(points.ToArray(), rots.ToArray()); for (int i = 0; i < num; i++) { float v = (float)i / num; Vector3 pt; // pt = shapePath.getPointInfoVec3Percent(v); PathVector pv = shapePath.getPathInfo(v); pt = new Vector3(pv.x, pv.y, pv.z); Gizmos.color = color; Gizmos.DrawWireSphere(pt, 0.25f); Quaternion rot = pv.rot; // Gizmos.color = new Color(0, 0, 0, 0.25f); Gizmos.DrawRay(pt, rot * Vector3.up * 2); Gizmos.DrawRay(pt, rot * Vector3.right * 2); Quaternion q2 = GetQuaternionAt(v); Gizmos.color = Color.green; Gizmos.DrawRay (pt, q2* Vector3.up); Gizmos.color = Color.red; Gizmos.DrawRay (pt, q2* Vector3.right); } } }