public void TestMeshSpawnerItem() { var tool = new MeshSpawnerItem("Core\\Barrel01", createObjectsFactory()); tool.OnSelected(); engine.AddSimulator(new BasicSimulator(tool.Update)); engine.AddSimulator(new PhysicalSimulator()); engine.AddSimulator(new WorldRenderingSimulator()); }
private Physical getPhysical(MeshSpawnerItem item) { if (physicals.ContainsKey(item)) { return(physicals[item]); } var physical = new Physical(); physical.Mesh = TW.Assets.LoadMesh(item.MeshPath); // Make unit size var meshBB = TW.Assets.GetBoundingBox(physical.Mesh); physical.ObjectMatrix = Matrix.Translation(-meshBB.GetCenter()) * Matrix.Scaling(MathHelper.One / meshBB.GetSize().MaxComponent()); physicals[item] = physical; return(physical); }