Exemplo n.º 1
0
        public override void Initialize()
        {
            var model = TryAndGetModelFromOwner();

            if (model != null)
            {
                Vector3[] vertices;
                int[]     indices;

                ModelDataExtractor.GetVerticesAndIndicesFromModel(model, out vertices, out indices);

                var mesh = new StaticMesh(MathConverter.Convert(vertices), indices,
                                          new BEPUutilities.AffineTransform(MathConverter.Convert(Owner.World.Translation)));

                mesh.Tag = Owner.ID;

                //static mesh is the only exception when working with physics entities
                PhysicsManager.AddStaticMesh(mesh);
            }

            base.Initialize();
        }