Hi Guys,
Ive got a function that makes a quad that links two points in space. The function also rotates teh quad to face the camera when its made (with the various cross products etc) I want the quad to always be aligned with the ground plane. And not just aligned, but the way the vertexes are extruded from must be equal on this plane. What should I alter in the following code? Im having a bit of a brainfreeze on this for some reason ![]()
Thanks
MakeQuad(Vector3 s, Vector3 e, float w) {
w = w / 2;
Vector3[] q = new Vector3[4];
Vector3 n = Vector3.Cross(s, e);
Vector3 l = Vector3.Cross(n, e-s);
l.Normalize();
q[0] = transform.InverseTransformPoint(s + l * w);
q[1] = transform.InverseTransformPoint(s + l * -w);
q[2] = transform.InverseTransformPoint(e + l * w);
q[3] = transform.InverseTransformPoint(e + l * -w);
return q;