public void AddTestUnitCube(Vector3 vector3) { ProceduralCube s = new ProceduralCube(); s.SetColor(Color.White); s.Translate(vector3); AddAndInitialiseGameObject(GameObjectFactory.CreateRenderableGameObjectFromShape(s, EffectLoader.LoadSM5Effect("flatshaded"))); }
public void AddVoxel(Color color) { if (!RenderGrid) { return; } if (currentbuildPoint.X < -modellingAreaSize / 2 || currentbuildPoint.X > modellingAreaSize / 2) { return; } if (currentbuildPoint.Y < -modellingAreaSize / 2 || currentbuildPoint.Y > modellingAreaSize / 2) { return; } if (currentbuildPoint.Z < -modellingAreaSize / 2 || currentbuildPoint.Z > modellingAreaSize / 2) { return; } ProceduralCube c = new ProceduralCube(); c.SetColor(color); //this object is for visualisation in the editor only. The procedural shape will be //cached and used to bake the final shape for serialization var tempObject = GameObjectFactory.CreateRenderableGameObjectFromShape(c, EffectLoader.LoadSM5Effect("flatshaded")); tempObject.AddComponent(new PhysicsComponent(false, false, PhysicsMeshType.box)); SystemCore.GameObjectManager.AddAndInitialiseGameObject(tempObject); tempObject.Transform.SetPosition(currentbuildPoint); //shape is translated c.Translate(currentbuildPoint); shapesToBake.Add(tempObject, c); }