I am trying to use the frustum culling to determine whether a point is inside or outside the frustum. I understand that pointInsideFrustum(point) does exactly that. As I understand it, the parameter is a float list for the x,y,z coordinates. I am trying to use a variable to set the coordinates according to the worldPosition of an empty this little script is attached to. I hope to attach this to 1000’s of empties, with each empty returning its own worldPosition and setting the pointInsideFrustum parameter accordingly. Does anyone have any suggestions?
The end result would be to use it to spawn objects like this;
<b>from</b> <b>bge</b> <b>import</b> logic
cont = logic.getCurrentController()
cam = cont.owner
<i># Test point [variable for empty coordinates]</i>
<b>if</b> (cam.pointInsideFrustum([#variable for empty coodinates#])):
<i># add object code here</i>
<b>else</b>:
<i># end object code here</i>
the function name is pointInsideFrustum, not points, so you probably need to call it for every empty world location and give it the location vector (which should automatically convert from Vector3 to a sequence of 3 floats).
I think I get it, but that seems like more work than it has to be. I thought there would be a simple way to declare the float list parameter as the current worldPosition of the empty the script is attached to. I am not sure if the parameter has to be in a float list format or if I could use something like pointInsideFrustum(own.worldPosition). I thought worldPosition returns a float list, so I was hoping that would work. If that is not the case, it seems like I would have to build a list of coordinates and constantly check to see if any of them are in the frustum.