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

CreateMovableObject() public method

public CreateMovableObject ( string name, string typeName, NamedParameterList para ) : Axiom.Core.MovableObject
name string
typeName string
para NamedParameterList
return Axiom.Core.MovableObject
		public MovableObject CreateMovableObject( string name, string typeName, NamedParameterList para )
		{
			// Nasty hack to make generalized Camera functions work without breaking add-on SMs
			if ( typeName == "Camera" )
			{
				return this.CreateCamera( name );
			}

			// Check for duplicate names

			MovableObjectCollection objectMap = this.GetMovableObjectCollection( typeName );

			if ( objectMap.ContainsKey( name ) )
			{
				throw new AxiomException( "An object with the name " + name + " already exists in the list." );
			}

			MovableObjectFactory factory = Root.Instance.GetMovableObjectFactory( typeName );

			MovableObject newObj = factory.CreateInstance( name, this, para );
			objectMap.Add( name, newObj );
			return newObj;
		}

Usage Example

		/// <summary>
		/// 
		/// </summary>
		/// <param name="sceneMgr"></param>
		private void SetupBody( SceneManager sceneMgr )
		{
			// create main model
			bodyNode = sceneMgr.RootSceneNode.CreateChildSceneNode( Vector3.UnitY * CharHeight );
			bodyEnt = sceneMgr.CreateEntity( "SinbadBody", "Sinbad.mesh" );
			bodyNode.AttachObject( bodyEnt );

			// create swords and attach to sheath
			sword1 = sceneMgr.CreateEntity( "SinbadSword1", "Sword.mesh" );
			sword2 = sceneMgr.CreateEntity( "SinbadSword2", "Sword.mesh" );
			bodyEnt.AttachObjectToBone( "Sheath.L", sword1 );
			bodyEnt.AttachObjectToBone( "Sheath.R", sword2 );

			// create a couple of ribbon trails for the swords, just for fun
			NamedParameterList paras = new NamedParameterList();
			paras[ "numberOfChains" ] = "2";
			paras[ "maxElements" ] = "80";
			swordTrail = (RibbonTrail)sceneMgr.CreateMovableObject( "SinbadRibbon", "RibbonTrail", paras );
			swordTrail.MaterialName = "Examples/LightRibbonTrail";
			swordTrail.TrailLength = 20;
			swordTrail.IsVisible = false;
			sceneMgr.RootSceneNode.AttachObject( swordTrail );

			for ( int i = 0; i < 2; i++ )
			{
				swordTrail.SetInitialColor( i, new ColorEx( 1, 0.8f, 0 ) );
				swordTrail.SetColorChange( i, new ColorEx( 0.75f, 0.25f, 0.25f, 0.25f ) );
				swordTrail.SetWidthChange( i, 1 );
				swordTrail.SetInitialWidth( i, 0.5f );
			}

			keyDirection = Vector3.Zero;
			verticalVelocity = 0;

		}
SceneManager