角度偏移

xiaoxiao2021-02-28  4

private float distance = 50; // 物体正前方距离的dist的点的坐标  Vector3 position = transform.rotation * v3.forward *   distance   + target.position; // 角度偏移 // 偏移量  Quaternion.Euler(y, x, 0.0f); // 绕y轴旋转30, 旋转的角度  // x 10米的位置 Quaternion roration = Quaternion.Euler (0f,30f,0f)*tag.rotation;  newPos = roration * new Vector3 (10f,0f,0f); // 于正前方的夹角(左,右) Quaternion ro = Quaternion.Euler (r.eulerAngles.x,r.eulerAngles.y-30f,r.eulerAngles.z); Quaternion r1 = Quaternion.Euler (r.eulerAngles.x,r.eulerAngles.y+30f,r.eulerAngles.z); // 当前坐标向上下偏移30度后,距离dist的点的坐标 Vector3 f1 = transform.position + ro * Vector3.forward * dist; Vector3 f2 = transform.position + r1 * Vector3.forward * dist; //   2  Quaternion RO = r * Quaternion.AngleAxis (30f,Vector3.down); Quaternion R1 = r * Quaternion.AngleAxis (30f,Vector3.up); // 先算正前方的dist的点,在偏移上下30度。 Vector3 FO = transform.position + Vector3.forward * dist; Vector3 LeftPoint = RO * FO; Vector3 RightPoint = R1 * FO;  private float distance = 50; // 物体正前方距离的dist的点的坐标  Vector3 position = transform.rotation * v3.forward *   distance   + target.position; // 角度偏移 // 偏移量  Quaternion.Euler(y, x, 0.0f); // 绕y轴旋转30, 旋转的角度  // x 10米的位置 Quaternion roration = Quaternion.Euler (0f,30f,0f)*tag.rotation;  newPos = roration * new Vector3 (10f,0f,0f); // 于正前方的夹角(左,右) Quaternion ro = Quaternion.Euler (r.eulerAngles.x,r.eulerAngles.y-30f,r.eulerAngles.z); Quaternion r1 = Quaternion.Euler (r.eulerAngles.x,r.eulerAngles.y+30f,r.eulerAngles.z); // 当前坐标向上下偏移30度后,距离dist的点的坐标 Vector3 f1 = transform.position + ro * Vector3.forward * dist; Vector3 f2 = transform.position + r1 * Vector3.forward * dist; //   2  Quaternion RO = r * Quaternion.AngleAxis (30f,Vector3.down); Quaternion R1 = r * Quaternion.AngleAxis (30f,Vector3.up); // 先算正前方的dist的点,在偏移上下30度。 Vector3 FO = transform.position + Vector3.forward * dist; Vector3 LeftPoint = RO * FO; Vector3 RightPoint = R1 * FO;
转载请注明原文地址: https://www.6miu.com/read-2399954.html

最新回复(0)