private void CreateBody(Physics2D.World world)
        {
            Physics2D.Body body = Physics2D.BodyFactory.CreateBody(world);

            if (tsMaterial == null)
            {
                tsMaterial = GetComponent <TSMaterial>();
            }

            Physics2D.Shape shape = Shape;
            if (shape != null)
            {
                CreateBodyFixture(body, shape);
            }
            else
            {
                Physics2D.Shape[] shapes = CreateShapes();
                for (int index = 0, length = shapes.Length; index < length; index++)
                {
                    CreateBodyFixture(body, shapes[index]);
                }
            }

            if (tsRigidBody == null)
            {
                body.BodyType = Physics2D.BodyType.Static;
            }
            else
            {
                if (tsRigidBody.isKinematic)
                {
                    body.BodyType = SyncFrame.Physics2D.BodyType.Kinematic;
                }
                else
                {
                    body.BodyType      = Physics2D.BodyType.Dynamic;
                    body.IgnoreGravity = !tsRigidBody.useGravity;
                }

                if (tsRigidBody.mass <= 0)
                {
                    tsRigidBody.mass = 1;
                }

                body.FixedRotation = tsRigidBody.freezeZAxis;
                body.Mass          = tsRigidBody.mass;
                body.TSLinearDrag  = tsRigidBody.drag;
                body.TSAngularDrag = tsRigidBody.angularDrag;
            }

            body.IsSensor     = isTrigger;
            body.CollidesWith = Physics2D.Category.All;

            _body = body;
        }
        private void CreateBody()
        {
            RigidBody newBody = new RigidBody(Shape);

            if (tsMaterial == null)
            {
                tsMaterial = GetComponent <TSMaterial>();
            }

            if (tsMaterial != null)
            {
                newBody.TSFriction    = tsMaterial.friction;
                newBody.TSRestitution = tsMaterial.friction;
            }

            newBody.IsColliderOnly = isTrigger;
            newBody.IsKinematic    = tsRigidBody != null && tsRigidBody.isKinematic;

            bool isStatic = tsRigidBody == null || tsRigidBody.isKinematic;

            if (tsRigidBody != null)
            {
                newBody.AffectedByGravity = tsRigidBody.useGravity;

                if (tsRigidBody.mass <= 0)
                {
                    tsRigidBody.mass = 1;
                }

                newBody.Mass          = tsRigidBody.mass;
                newBody.TSLinearDrag  = tsRigidBody.drag;
                newBody.TSAngularDrag = tsRigidBody.angularDrag;
            }
            else
            {
                newBody.SetMassProperties();
            }

            if (isStatic)
            {
                newBody.AffectedByGravity = false;
                newBody.IsStatic          = true;
            }

            _body = newBody;
        }