public override void Register(PhysicsWorld physics)
        {
            if (pworld == physics)
            {
                return;
            }
            pworld = physics;
            Collider cld = null;

            if (SurPath == null)  //sphere
            {
                cld = new SphereCollider(SphereRadius);
            }
            else
            {
                var mr = (ModelRenderer)Parent.RenderComponent;
                sur = new SurCollider(SurPath);
                cld = sur;
                if (Parent.RigidModel.From3db)
                {
                    sur.AddPart(PlainCrc, Matrix4x4.Identity, null);
                }
                else
                {
                    foreach (var part in Parent.RigidModel.AllParts)
                    {
                        var crc = CrcTool.FLModelCrc(part.Name);
                        if (part.Construct == null)
                        {
                            sur.AddPart(crc, Matrix4x4.Identity, part);
                        }
                        else
                        {
                            sur.AddPart(crc, part.LocalTransform, part);
                        }
                    }
                }
            }
            if (Mass < float.Epsilon)
            {
                Body = physics.AddStaticObject(Parent.GetTransform(), cld);
            }
            else
            {
                Body = physics.AddDynamicObject(Mass, Parent.GetTransform(), cld, Inertia);
            }
            Body.Tag = Parent;
            collider = cld;
        }
        public AsteroidFieldComponent(AsteroidField field, GameObject parent) : base(parent)
        {
            Field = field;
            //var shapes = new List<CompoundSurShape.TransformedShape>();
            Dictionary <string, int> indexes = new Dictionary <string, int>();

            foreach (var asteroid in Field.Cube)
            {
                var mdl  = asteroid.Drawable as ModelFile;
                var path = Path.ChangeExtension(mdl.Path, "sur");
                if (File.Exists(path))
                {
                    int idx;
                    if (!indexes.TryGetValue(path, out idx))
                    {
                        if (shape == null)
                        {
                            shape = new SurCollider(path);
                            idx   = 0;
                            indexes.Add(path, 0);
                        }
                        else
                        {
                            idx = shape.LoadSur(path);
                            indexes.Add(path, idx);
                        }
                    }
                    shape.AddPart(0, asteroid.RotationMatrix * Matrix4.CreateTranslation(asteroid.Position * field.CubeSize), null, idx);
                }
                else
                {
                    FLLog.Error("Sur", "Hitbox not found " + path);
                }
            }
            float rdist = 0f;

            if (field.Zone.Shape is ZoneSphere)
            {
                rdist = ((ZoneSphere)field.Zone.Shape).Radius;
            }
            else if (field.Zone.Shape is ZoneEllipsoid)
            {
                var s = ((ZoneEllipsoid)field.Zone.Shape).Size;
                rdist = Math.Max(Math.Max(s.X, s.Y), s.Z);
            }
            else if (field.Zone.Shape is ZoneBox)
            {
                var s = ((ZoneEllipsoid)field.Zone.Shape).Size;
                rdist = Math.Max(Math.Max(s.X, s.Y), s.Z);
            }
            rdist       += COLLIDE_DISTANCE;
            activateDist = rdist * rdist;
        }