Axiom.Core.Entity.AttachObjectToBone C# (CSharp) Method

AttachObjectToBone() public method

Attaches another object to a certain bone of the skeleton which this entity uses.
This method can be used to attach another object to an animated part of this entity, by attaching it to a bone in the skeleton (with an offset if required). As this entity is animated, the attached object will move relative to the bone to which it is attached.
public AttachObjectToBone ( string boneName, Axiom.Core.MovableObject sceneObject ) : Axiom.Animating.TagPoint
boneName string The name of the bone (in the skeleton) to attach this object.
sceneObject Axiom.Core.MovableObject Reference to the object to attach.
return Axiom.Animating.TagPoint
		public TagPoint AttachObjectToBone( string boneName, MovableObject sceneObject )
		{
			return this.AttachObjectToBone( boneName, sceneObject, Quaternion.Identity );
		}

Same methods

Entity::AttachObjectToBone ( string boneName, Axiom.Core.MovableObject sceneObject, Quaternion offsetOrientation ) : Axiom.Animating.TagPoint
Entity::AttachObjectToBone ( string boneName, Axiom.Core.MovableObject sceneObject, Quaternion offsetOrientation, Vector3 offsetPosition ) : Axiom.Animating.TagPoint

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;

		}