public static OSD ObjectPhysicsProperties(ISceneChildEntity[] entities)
        {
            ObjectPhysicsPropertiesMessage message = new ObjectPhysicsPropertiesMessage();
#if (!ISWIN)
            int i = 0;
            foreach (ISceneChildEntity entity in entities)
            {
                if (entity != null) i++;
            }
#else
            int i = entities.Count(entity => entity != null);
#endif

            message.ObjectPhysicsProperties = new Primitive.PhysicsProperties[i];
            i = 0;
#if (!ISWIN)
            foreach (ISceneChildEntity entity in entities)
            {
                if (entity != null)
                {
                    message.ObjectPhysicsProperties[i] = new Primitive.PhysicsProperties
                                                             {
                                                                 Density = entity.Density,
                                                                 Friction = entity.Friction,
                                                                 GravityMultiplier = entity.GravityMultiplier,
                                                                 LocalID = entity.LocalId,
                                                                 PhysicsShapeType =
                                                                     (PhysicsShapeType) entity.PhysicsType,
                                                                 Restitution = entity.Restitution
                                                             };
                    i++;
                }
            }
#else
            foreach (ISceneChildEntity entity in entities.Where(entity => entity != null))
            {
                message.ObjectPhysicsProperties[i] = new Primitive.PhysicsProperties
                                                         {
                                                             Density = entity.Density,
                                                             Friction = entity.Friction,
                                                             GravityMultiplier = entity.GravityMultiplier,
                                                             LocalID = entity.LocalId,
                                                             PhysicsShapeType = (PhysicsShapeType) entity.PhysicsType,
                                                             Restitution = entity.Restitution
                                                         };
                i++;
            }
#endif

            OSDMap m = new OSDMap {{"message", OSD.FromString("ObjectPhysicsProperties")}};
            OSD message_body = message.Serialize();
            m.Add("body", message_body);
            return m;
        }
        public static OSD ObjectPhysicsProperties (ISceneChildEntity[] entities)
        {
            ObjectPhysicsPropertiesMessage message = new ObjectPhysicsPropertiesMessage ();
            int i = 0;
            foreach (ISceneChildEntity entity in entities)
            {
                if (entity == null)
                    continue;
                i++;
            }

            message.ObjectPhysicsProperties = new Primitive.PhysicsProperties[i];
            i = 0;
            foreach(ISceneChildEntity entity in entities)
            {
                if (entity == null)
                    continue;
                message.ObjectPhysicsProperties[i] = new Primitive.PhysicsProperties ();
                message.ObjectPhysicsProperties[i].Density = entity.Density;
                message.ObjectPhysicsProperties[i].Friction = entity.Friction;
                message.ObjectPhysicsProperties[i].GravityMultiplier = entity.GravityMultiplier;
                message.ObjectPhysicsProperties[i].LocalID = entity.LocalId;
                message.ObjectPhysicsProperties[i].PhysicsShapeType = (PhysicsShapeType)entity.PhysicsType;
                message.ObjectPhysicsProperties[i].Restitution = entity.Restitution;
                i++;
            }

            OSDMap m = new OSDMap ();
            m.Add ("message", OSD.FromString ("ObjectPhysicsProperties"));
            OSD message_body = message.Serialize ();
            m.Add ("body", message_body);
            return m;
        }