Axiom.Core.SceneManager.CreateEntity C# (CSharp) Method

CreateEntity() public method

Create an Entity (instance of a discrete mesh).
public CreateEntity ( string name, PrefabEntity prefab ) : Entity
name string The name to be given to the entity (must be unique).
prefab PrefabEntity The name of the mesh to load. Will be loaded if not already.
return Entity
		public virtual Entity CreateEntity( string name, PrefabEntity prefab )
		{
			switch ( prefab )
			{
				case PrefabEntity.Plane:
					return this.CreateEntity( name, "Prefab_Plane" );
				case PrefabEntity.Cube:
					return this.CreateEntity( name, "Prefab_Cube" );
				case PrefabEntity.Sphere:
					return this.CreateEntity( name, "Prefab_Sphere" );
				default:
					return null;
			}
		}

Same methods

SceneManager::CreateEntity ( string name, Axiom.Core.Mesh mesh ) : Entity
SceneManager::CreateEntity ( string name, string meshName ) : Entity

Usage Example

Beispiel #1
0
        public Arena(SceneManager pSceneManager, Int32 pScale, Int32 pNumAdditionalGrids)
        {
            var random = new Random();
            var topgrid = pSceneManager.CreateEntity("grid top", "grid.mesh");
            var topgridnode = pSceneManager.RootSceneNode.CreateChildSceneNode("grid top");

            topgridnode.Position = new Vector3(0, 0, -10);
            topgridnode.Orientation = Quaternion.FromAxes(Vector3.UnitX, Vector3.UnitZ, Vector3.NegativeUnitY);
            topgridnode.Scale = new Vector3(pScale, 1, pScale);
            topgridnode.AttachObject(topgrid);

            Width = (Int32)(topgrid.BoundingBox.Size.x * pScale);
            Height = (Int32)(topgrid.BoundingBox.Size.z * pScale);

            Right = Width / 2;
            Bottom = Height / 2;
            Left = -Right;
            Top = -Bottom;

            for (var i = 1; i <= pNumAdditionalGrids; i++)
            {
                var grid = pSceneManager.CreateEntity("grid" + i, "grid.mesh");
                var gridnode = pSceneManager.RootSceneNode.CreateChildSceneNode("grid" + i);

                gridnode.Position = new Vector3(
                    random.Next(-pScale / 5, pScale / 5),
                    random.Next(-pScale / 5, pScale / 5),
                    -10 - pScale * i / 10);
                gridnode.Orientation = Quaternion.FromAxes(
                    Vector3.UnitX,
                    Vector3.UnitZ,
                    Vector3.NegativeUnitY);
                gridnode.Scale = new Vector3(
                    pScale + i * random.Next(pScale / 8, pScale / 4),
                    1,
                    pScale + i * random.Next(pScale / 8, pScale / 4));
                gridnode.AttachObject(grid);
            }
        }
All Usage Examples Of Axiom.Core.SceneManager::CreateEntity
SceneManager