align a mesh with a plane?

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 :stuck_out_tongue:

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;

ok i worked it out about 2 mins after posting.
Just need to set the result of the cross products to have a zero y magnitude

Sorry for wasting valuble internets space :slight_smile: