(disregard, not a problem)AddPhysicsBodyForCanvasWithBehaviors is clipped to rectangle

Apr 23, 2012 at 4:21 PM

Having a problem with larger items where they are clipped when I add them using the controller add from canvas method. If I place them in XAML it does not clip though, anyone know what I am doing wrong or what needs to be set?

For example if I have an ellipse in a user control that is 300 by 300 and add it using

_physicsController.AddPhysicsBodyForCanvasWithBehaviors(canvas.root);

 

The item is added and functions correctly but the visual is clipped to about 200 by 200.

 

But if I add the Ellipse in xaml with the physics behavior it is not clipped.

 

Coordinator
Apr 23, 2012 at 4:29 PM

I would check that the Width and Height of the Canvas is big enough to cover its contents when added through code. The boundary detection algorithm relies on explicit height and width to know where to search for the boundary.

Hope this helps.

Apr 24, 2012 at 2:42 PM
Edited Apr 24, 2012 at 2:51 PM
andybeaulieu wrote:

I would check that the Width and Height of the Canvas is big enough to cover its contents when added through code. The boundary detection algorithm relies on explicit height and width to know where to search for the boundary.

Hope this helps.


Thank you Andy, good to know! It actually ended up being some silverlight quirk with cache mode on the ellipse. If you set bitmap cache on an ellipse in xaml and then load the user control from code it gets clipped. So strange! Although a plain ellipse should not need cache mode I suppose. Thank you for the help and the wonderful library!

Coordinator
Apr 24, 2012 at 3:14 PM

Is this using WP7? If so maybe it is an issue with the size of the ellipse (there is a limit of how large cached elements can be due to GPU limitations on those devices).

You _do_ want to bitmap cache any physics elements if you can - especially on a phone - because things really slow down with software rendering.

Apr 24, 2012 at 3:30 PM
andybeaulieu wrote:

Is this using WP7? If so maybe it is an issue with the size of the ellipse (there is a limit of how large cached elements can be due to GPU limitations on those devices).

You _do_ want to bitmap cache any physics elements if you can - especially on a phone - because things really slow down with software rendering.


Yes, it is WP7! That is probably it. Although what is weird is that it only happens if I add the user control through code. If I add the user control in xaml it is fine with the exact same bitmap cache settings.. I can just cache it after it is loaded, that seems to work too!