This project has moved and is read-only. For the latest updates, please go here.

Odd performance issue...

Topics: Developer Forum, User Forum
Nov 22, 2010 at 3:50 AM

Hey Genbox I'm loving the new farseer, and in most cercomstances it runs beautifully.

I am having a very odd problem.

Basicly i have 1 body with 40 circle fixtures in it (these were originally different) and this is set to be kinimatic.
Then i have 1-3 dynamic circles which can collide with each other and the kinimatic body.

This runs fine unless i try to move or rotate the kinimatic body then the framerate drops from 30 down to 2...

How should i go about fixing this?

Also i have added touch support to all the samples for selecting menus and draging physics around on the phone, I have also added a tilt based gravity mode that can be set on demos too.
Let me know if you want any of it, it basicly lets you do everything you can do on the pc demos on the phone.

Nov 22, 2010 at 3:57 AM
Edited Nov 22, 2010 at 3:58 AM

I don't see any problems with your setup just by description only. Have you tried profiling the problem? It might be a bug in Box2D.

As for the samples, I've just upgraded them to support multiple inputs and touch support - but not in the samples themselves. You are more than welcome to add WP7 input to the samples. As for the tilt based gravity, I think that it should be included in one of the advanced samples. If you could hook up a sample (a bunch of balls that fall to the bottom of the screen when WP7 is rotated) it would be great.

Edit: By touch support I mean that the InputHelper class can read WP7 input.

Nov 22, 2010 at 4:10 AM

Yer i did a little profiling and all the slowdown seems to be in the set property for Position and Rotation.

Each of these calls SetTransform() which calls ContactManager.FindNewContacts() which calls BroadPhase.UpdatePairs();

And thats what seems to take forever (because it obviosly has to re-build and balence the entire tree...)

At least i think thats what is doing it, in farseer 2.x when you moved an object it didn't have to rebuild the tree did it?

Anyway the performance in general (with some tweaks) is great on the phone, i can have around 75 dynamic circles all colliding and still get 30 fps!

but moving any objects (kinimatic or dynamic, havnt tried static) using the position and rotation propertys destroys all performance.

Ill get the sample demo for tilt sent over.
I have changed the base demo class so that in all demos you can just drag objects around with your finger instead of the mouse, would you like the updated one of these too?

Anyway if you can think of anyway to improve performance for my odd useage that would be great. :) 







Nov 22, 2010 at 4:14 AM

There is a SetTransformIgnoreContacts() method you should try out.