public Body CreateBody(BodyDefinition definition) { var body = new Body(_world, definition.Position, definition.Angle); body.BodyType = BodyType.Dynamic; body.LinearVelocity = definition.LinearVelocity; return body; }
public Physics2dComponent CreateComponent(Entity entity, BodyDefinition definition, bool remoteSync = true) { var body = CreateBody(definition); var component = new Physics2dComponent(); component.Body = body; body.UserData = entity; entity.AddComponent(component); if (remoteSync) { ObjectMapper.Create( (uint)entity.UniqueId, typeof(NetPhysicsObject)); } return component; }