Axiom.Core.Node.WeightedTransform C# (CSharp) Method

WeightedTransform() private method

This method transforms a Node by a weighted amount from its initial state. If weighted transforms have already been applied, the previous transforms and this one are blended together based on their relative weight. This method should not be used in combination with the unweighted rotate, translate etc methods.
private WeightedTransform ( float weight, Vector3 translate, Axiom.MathLib.Quaternion rotate, Vector3 scale ) : void
weight float
translate Vector3
rotate Axiom.MathLib.Quaternion
scale Vector3
return void
		internal virtual void WeightedTransform( float weight, Vector3 translate, Quaternion rotate, Vector3 scale )
		{
			WeightedTransform( weight, translate, rotate, scale, false );
		}

Same methods

Node::WeightedTransform ( float weight, Vector3 translate, Axiom.MathLib.Quaternion rotate, Vector3 scale, bool lookInMovementDirection ) : void

Usage Example

Beispiel #1
0
		/// <summary>
		///		Same as the Apply method, but applies to a specified Node instead of it's associated node.
		/// </summary>
		public void ApplyToNode( Node node, float time, float weight, bool accumulate, float scale )
		{
			this.GetInterpolatedKeyFrame( time, kf );

			if ( accumulate )
			{
				// add to existing. Weights are not relative, but treated as absolute multipliers for the animation
				Vector3 translate = kf.Translate * weight * scale;
				node.Translate( translate );

				// interpolate between not rotation and full rotation, to point weight, so 0 = no rotate, and 1 = full rotation
				Quaternion rotate = Quaternion.Slerp( weight, Quaternion.Identity, kf.Rotation );
				node.Rotate( rotate );

				// TODO: not yet sure how to modify scale for cumulative animations
				Vector3 scaleVector = kf.Scale;
				// Not sure how to modify scale for cumulative anims... leave it alone
				//scaleVector = ((Vector3::UNIT_SCALE - kf.getScale()) * weight) + Vector3::UNIT_SCALE;
				if ( scale != 1.0f && scaleVector != Vector3.UnitScale )
					scaleVector = Vector3.UnitScale + ( scaleVector - Vector3.UnitScale ) * scale;
				node.ScaleBy( scaleVector );
			}
			else
			{
				// apply using weighted transform method
				node.WeightedTransform( weight, kf.Translate, kf.Rotation, kf.Scale );
			}
		}