Axiom.Core.Node.Translate C# (CSharp) Метод

Translate() публичный Метод

Moves the node along arbitrary axes.
This method translates the node by a vector which is relative to a custom set of axes.
public Translate ( Matrix3 axes, Vector3 move ) : void
axes Matrix3 3x3 Matrix containg 3 column vectors each representing the /// X, Y and Z axes respectively. In this format the standard cartesian axes would be expressed as: /// 1 0 0 /// 0 1 0 /// 0 0 1 /// i.e. The Identity matrix. ///
move Vector3 Vector relative to the supplied axes.
Результат void
		public virtual void Translate( Matrix3 axes, Vector3 move )
		{
			Vector3 derived = axes * move;
			Translate( derived, TransformSpace.Parent );
		}

Same methods

Node::Translate ( Matrix3 axes, Vector3 move, TransformSpace relativeTo ) : void
Node::Translate ( Vector3 translate ) : void
Node::Translate ( Vector3 translate, TransformSpace relativeTo ) : void

Usage Example

Пример #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 );
			}
		}