Beispiel #1
0
 public static Body CreateCharacter(this World world, BodyDefinitionWrapper bodyDefinition, PolygonDef polygonDefinition)
 {
     lock (locker)
     {
         var body = world.CreateBody(bodyDefinition.BodyDefiniton);
         body.SetUserData(bodyDefinition.UserData);
         body.CreateShape(polygonDefinition);
         body.SetMassFromShapes();
         return(body);
     }
 }
Beispiel #2
0
        public static BodyDefinitionWrapper CreateBodyDefinitionWrapper(PolygonDef fixture, Vector2 position, object userData = null)
        {
            var bodyDefinition = new BodyDef();

            bodyDefinition.Position.Set(position.X, position.Y);
            bodyDefinition.FixedRotation = true;

            var bodyDefinitionWrapper = new BodyDefinitionWrapper(bodyDefinition, fixture, userData);

            return(bodyDefinitionWrapper);
        }