本文整理汇总了C++中EntityMatrix::LocalToWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ EntityMatrix::LocalToWorld方法的具体用法?C++ EntityMatrix::LocalToWorld怎么用?C++ EntityMatrix::LocalToWorld使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityMatrix
的用法示例。
在下文中一共展示了EntityMatrix::LocalToWorld方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupForces
void CPhysThruster::SetupForces( IPhysicsObject *pPhys, Vector &linear, AngularImpulse &angular )
{
Vector forward;
AngleVectors( GetLocalAngles(), &forward );
forward = forward * m_force;
// multiply the force by mass (it's actually just an acceleration)
if ( m_spawnflags & SF_THRUST_MASS_INDEPENDENT )
{
forward = forward * pPhys->GetMass();
}
EntityMatrix xform;
xform.InitFromEntity( m_attachedObject );
Vector origin = xform.LocalToWorld( m_localOrigin );
forward = xform.LocalToWorldRotation( forward );
// Adjust for the position of the thruster -- apply proper torque)
pPhys->CalculateVelocityOffset( forward, origin, linear, angular );
// Stay in local space always if this flag is set
if ( m_spawnflags & SF_THRUST_LOCAL_ORIENTATION )
{
linear = xform.WorldToLocalRotation( linear );
}
if ( !(m_spawnflags & SF_THRUST_FORCE) )
{
// clear out force
linear.Init();
}
if ( !(m_spawnflags & SF_THRUST_TORQUE) )
{
// clear out torque
angular.Init();
}
}
示例2:
Vector WorldBarrelPosition( void )
{
EntityMatrix tmp;
tmp.InitFromEntity( this );
return tmp.LocalToWorld( m_barrelPos );
}