Path to Body

Dec 4, 2012 at 6:38 PM

I'm trying to make a level editor where you can draw the objects.  It works fine if I draw an object where the 2 ends meet like a square or circle.  But if I draw just a line it doesn't create the physics object.  I've tried a lot of different ways but couldn't get it to work. Here is how I'm trying to do it.  Any help would be great.

 

Path p = getPathFromStroke(stroke);
               
                CnvGame.Children.Add(p);
              
                BehaviorCollection bc1 = Interaction.GetBehaviors(p);
                PhysicsObjectBehavior b1 = new PhysicsObjectBehavior();
                b1.IsStatic = true;
                b1.FrictionCoefficient = .01;
                bc1.Add(b1);
                PhysicsObjectMain m1 = (PhysicsObjectMain)p.GetValue(PhysicsObjectMain.PhysicsObjectProperty);
                _physicsController.AddPhysicsBody(m1);