I want to remove the entities outside of the camera to reduce physics simulations and physics time. Currently I am using trigger planes while basically are enabling and disabling the entities based on the player’s position.
I want to disable the entities which go behind the player.
PS: I have read the topic where Will suggests to use the frustum containsSphere against a bounding sphere,but I cannot have that many individual bounding sphere to test. So, I would want to know if any other solution exists or if anyone can suggest me a better solution then the existing one.
So are you saying, get position of every object at run time and do some vector math to calculate its relative position to the camera and disable or enable it? isn’t this inefficient since we are getting positions of objects continuously and doing some calculations?
I would check the relative z distance to either the player or the camera (so a subtraction and an if statement. If they are both under the same parent, then you can use localPosition to avoid the extra calculations needed for getting worldPosition). It’s no less efficient than any other method.