Mar 4, 2011 at 7:02 PM
Edited Mar 4, 2011 at 8:08 PM
Thanks for the response...
I guess I didn't explain myself in enough detail in my original post, so I will try to elaborate.
The reason I would prefer to get the PhysicsSprite from the Behavior is because I wrapped the Behavior into a UserControl, and I wanted to change the position of the PhysicsSprite from within my UserControl... the only way to do this (if I understand correctly)
is with the PhysicsSprite (as the PhysicsObjectBehavior doesn't have anyway to set the position), but I can't access the PhysicsController to get at the Sprite from my UserControl as its in a different scope. The application hierarchy looks something like
I got around this problem by implementing a PositionChanged event from my usercontrol, and setting an event handler for it on my MainPage where I can access my PhysicsController. Is there a better way to do this, do you think? The reason I need this is because
I want to animate the position of the usercontrol using a Storyboard, but I want the PhysicsObject to still be consistent with the usercontrols position.
The problem is that the position of the PhysicsObject does not update when I change the Canvas.Left and Canvas.Top property of my usercontrol. My first question is, is there any easy way to solve this problem?
My second question is, given only a physicsObjectBehavior, is there any way to get the physicsSprite from the Controller?