示例#1
0
        void DebugDrawSubobject(MyModelSubObject subObject, Vector3 color)
        {
            if (subObject != null)
            {
                Vector3 forward = Vector3.Forward;
                if (subObject.ForwardVector.HasValue)
                    forward = subObject.ForwardVector.Value;
                Vector3 up = Vector3.Up;
                if (subObject.UpVector.HasValue)
                    up = subObject.UpVector.Value;

                Matrix thrustMatrix = Matrix.CreateWorld(subObject.Position, forward, up);

                DebugDrawSubobject(new StringBuilder(subObject.Name), thrustMatrix, color);
            }
        }
示例#2
0
        MyModelShipSubOject AddSubObject(List<MyModelShipSubOject> subObjects, MyModelSubObject modelSubObject, bool createLight)
        {
            MyModelShipSubOject subObject = m_modelSubObjectsPool.Allocate();
            subObject.ModelSubObject = modelSubObject;

            if (subObjects != null)
                subObjects.Add(subObject);

            if (createLight)
            {
                subObject.Light = MyLights.AddLight();
                if (subObject.Light != null)
                {
                    subObject.Light.Start(MyLight.LightTypeEnum.PointLight, Color.White.ToVector4(), 0.8f, 1);
                    subObject.Light.LightOn = false;
                    subObject.Light.LightOwner = MyLight.LightOwnerEnum.SmallShip;
                }
            }

            m_subObjects.Add(subObject);

            return subObject;
        }