Hi
I want to display the frustum
planes of any given camera during the game. Not only the current camera, but
actually see the 'frustum' moving from other cameras.
I did a simple copy
and paste of the code from the script manual and the planes I see seem
completely off from the real frustum.
My code,
simple:
<code>
Plane[]
planes=GeometryUtility.CalculateFrustumPlanes(myca mera);
if (targetGO ==
null)
{
int i = 0;
while (i < planes.Length)
{
GameObject p =
GameObject.CreatePrimitive(PrimitiveType.Plane);
p.name = "Plane " +
i.ToString();
p.transform.position = -planes[i].normal *
planes[i].distance;
p.transform.rotation =
Quaternion.FromToRotation(Vector3.up,
planes[i].normal);
p.transform.localScale=new
Vector3(100f,100f,100f);
i++;
}
}
</code>
I
added the localScale to make sure it wasn't my imagination, but all frustum seem
to be positioned at the wrong place. When I display the planes using the code, I
see them like 1000 units away from the origin.
My camera is a children of
other objects, so I don't know if that's what's messing it up, I tried
'unchilding' it, but same behaviour.
International MBA, Concentration in Finance & Entrepreneurship
IE Business School, Founder IE Spain Club, www.iespainclub.com