本文整理汇总了C#中Matrix3x3.SetColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix3x3.SetColumn方法的具体用法?C# Matrix3x3.SetColumn怎么用?C# Matrix3x3.SetColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Matrix3x3
的用法示例。
在下文中一共展示了Matrix3x3.SetColumn方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _UpdateSpineUBasis
public void _UpdateSpineUBasis()
{
if( _isDirtySpineUBasis ) {
_isDirtySpineUBasis = false;
_spineUBasis = Matrix3x3.identity;
Vector3 dirY = (this.shoulderPos != null) ? (this.shoulderPos[1] + this.shoulderPos[0]) : (this.armPos[1] + this.armPos[0]);
dirY = dirY * 0.5f - this.spineUPos;
Vector3 dirX = (this.shoulderPos != null) ? (this.shoulderPos[1] - this.shoulderPos[0]) : (this.armPos[1] - this.armPos[0]);
Vector3 dirZ = Vector3.Cross( dirX, dirY );
dirX = Vector3.Cross( dirY, dirZ );
if( SAFBIKVecNormalize3( ref dirX, ref dirY, ref dirZ ) ) {
_spineUBasis.SetColumn( ref dirX, ref dirY, ref dirZ );
SAFBIKMatMultRet0( ref _spineUBasis, ref _spineUBoneLocalAxisBasisInv );
}
}
}
示例2: _ComputeWorldTransform
void _ComputeWorldTransform()
{
var temp = _solverInternal;
if( temp == null || temp.spinePos == null || temp.spinePos.Length == 0 ) {
return;
}
// Compute worldPosition / worldRotation.
if( _hipsBone != null && _hipsBone.transformIsAlive && temp.spinePos != null && temp.spinePos.Length > 0 && _neckBone != null && _neckBone.transformIsAlive ) {
Vector3 hipsToSpineDirX = new Vector3( 1.0f, 0.0f, 0.0f );
Vector3 dirX = temp.legs.beginPos[1] - temp.legs.beginPos[0];
Vector3 dirY = temp.spinePos[0] - (temp.legs.beginPos[1] + temp.legs.beginPos[0]) * 0.5f;
Matrix3x3 boneBasis = new Matrix3x3();
if( SAFBIKVecNormalize( ref dirY ) && SAFBIKComputeBasisFromXYLockY( out boneBasis, ref dirX, ref dirY ) ) {
Matrix3x3 tempBasis;
SAFBIKMatMult( out tempBasis, ref boneBasis, ref _centerLegBoneBasisInv );
hipsToSpineDirX = boneBasis.column0; // Counts as baseBasis.
Quaternion worldRotation;
SAFBIKMatMultGetRot( out worldRotation, ref tempBasis, ref _hipsBone._defaultBasis );
_hipsBone.worldRotation = worldRotation;
if( _hipsBone.isWritebackWorldPosition ) {
Vector3 worldPosition;
Vector3 inv_defaultLocalTranslate = -_spineBone._defaultLocalTranslate;
SAFBIKMatMultVecAdd( out worldPosition, ref tempBasis, ref inv_defaultLocalTranslate, ref temp.spinePos[0] );
_hipsBone.worldPosition = worldPosition;
}
} else { // Failsafe.
if( SAFBIKVecNormalize( ref dirX ) ) {
hipsToSpineDirX = dirX;
}
}
int spineLength = temp.spinePos.Length;
for( int i = 0; i != spineLength; ++i ) {
if( !_spineEnabled[i] ) {
continue;
}
if( i + 1 == spineLength ) {
dirY = temp.neckPos - temp.spinePos[i];
if( temp.nearArmPos != null ) {
dirX = temp.nearArmPos[1] - temp.nearArmPos[0];
} else { // Failsafe.
dirX = hipsToSpineDirX;
}
} else {
dirY = temp.spinePos[i + 1] - temp.spinePos[i];
dirX = hipsToSpineDirX;
if( temp.nearArmPos != null ) {
Vector3 dirX0 = temp.nearArmPos[1] - temp.nearArmPos[0];
if( SAFBIKVecNormalize( ref dirX0 ) ) {
dirX = Vector3.Lerp( dirX, dirX0, _settings.bodyIK.spineDirXLegToArmRate );
}
}
}
if( SAFBIKVecNormalize( ref dirY ) && SAFBIKComputeBasisFromXYLockY( out boneBasis, ref dirX, ref dirY ) ) {
hipsToSpineDirX = boneBasis.column0;
Quaternion worldRotation;
SAFBIKMatMultGetRot( out worldRotation, ref boneBasis, ref _spineBones[i]._boneToWorldBasis );
_spineBones[i].worldRotation = worldRotation;
if( _spineBones[i].isWritebackWorldPosition ) {
_spineBones[i].worldPosition = temp.spinePos[i];
}
}
}
if( _shoulderBones != null ) {
for( int i = 0; i != 2; ++i ) {
Vector3 xDir, yDir, zDir;
xDir = temp.armPos[i] - temp.shoulderPos[i];
if( _internalValues.shoulderDirYAsNeck != 0 ) {
yDir = temp.neckPos - temp.shoulderPos[i];
} else {
yDir = temp.shoulderPos[i] - temp.spineUPos;
}
xDir = (i == 0) ? -xDir : xDir;
zDir = Vector3.Cross( xDir, yDir );
yDir = Vector3.Cross( zDir, xDir );
if( SAFBIKVecNormalize3( ref xDir, ref yDir, ref zDir ) ) {
boneBasis.SetColumn( ref xDir, ref yDir, ref zDir );
Quaternion worldRotation;
SAFBIKMatMultGetRot( out worldRotation, ref boneBasis, ref _shoulderBones[i]._boneToWorldBasis );
_shoulderBones[i].worldRotation = worldRotation;
}
}
}
}
}
示例3: _UpdateCenterLegBasis
public void _UpdateCenterLegBasis()
{
if( _isDirtyCenterLegBasis ) {
_isDirtyCenterLegBasis = false;
var legPos = this.legPos;
_centerLegBasis = Matrix3x3.identity;
if( this.spinePos != null && this.spinePos.Length > 0 && legPos != null ) {
Vector3 dirX = legPos[1] - legPos[0];
Vector3 dirY = this.spinePos[0] - this.centerLegPos;
Vector3 dirZ = Vector3.Cross( dirX, dirY );
dirX = Vector3.Cross( dirY, dirZ );
if( SAFBIKVecNormalize3( ref dirX, ref dirY, ref dirZ ) ) {
_centerLegBasis.SetColumn( ref dirX, ref dirY, ref dirZ );
SAFBIKMatMultRet0( ref _centerLegBasis, ref _centerLegBoneBasisInv );
}
}
}
}
示例4: FromColumn
public static Matrix3x3 FromColumn( ref Vector3 column0, ref Vector3 column1, ref Vector3 column2 )
{
Matrix3x3 r = new Matrix3x3();
r.SetColumn( ref column0, ref column1, ref column2 );
return r;
}