Frustrum culling

Topics: Developer Forum, Project Management Forum, User Forum
May 12, 2011 at 10:38 AM

Is there a way to let farseer do something like frustrum culling?

So that bodies outside the camera view are disabled.

Because i got a big level with very diffucult shapes, that are very heavy

for physics, and I have a lot of lag because I'ts for the wp7.

anyone?

 

greets

May 15, 2011 at 5:50 PM

You could probably use world.QueryAABB and pass your screen space as the query region. I haven't tried that myself though.

May 17, 2011 at 12:00 AM

 

Hi, thanks for the tip, i tried it

but i got a problem i disable all bodies.

And the world.queryaabb doesn't enable them back.

WWhen i try to disable them with the aabb it orks when i try to enable it , it won't work.

Doesn't it detect when a body is disabled? And how i can say if it's in the aabb then enable, otherwise disable.

Becuase now i disable them all every 5 seconds, and then check again foor enable. But i won't enable them when they are disabled :s

 

 

worldPhys.QueryAABB(CheckAround,ref temp);


        public bool CheckAround(Fixture fix)
        {
            if (fix.Body.IsStatic == true)
            {
                fix.Body.Enabled = true;
                return true;
            }
            else
            {
               // fix.Body.Enabled = false;
                return false;
            }

            return false;
        }

anythign wrong :s ?