private void LayoutRootManipulationStarted(object sender, ManipulationStartedEventArgs e) { BehaviorCollection behaviorCollection = Interaction.GetBehaviors(_finger); if (behaviorCollection.Count == 0) { behaviorCollection.Add(new PhysicsObjectBehavior { BoundaryElement = "finger", IsStatic = true, IsSensor = true }); _physicsController.AddPhysicsBody( _finger.GetValue(PhysicsObjectMain.PhysicsObjectProperty) as PhysicsObjectMain); } PhysicsSprite finger = _physicsController.PhysicsObjects["finger"]; finger.Collision += FingerCollision; finger.BodyObject.OnSeparation += BodyObject_OnSeparation; //finger phys object already created if (finger != null) { finger.Position = new Vector2((float)(e.ManipulationOrigin.X), (float)(e.ManipulationOrigin.Y)); } e.Handled = true; }
void controller_Initialized(object source) { Controller.AddPhysicsBody(_physicsObjectMain); }