本文整理汇总了C++中IVP_U_Float_Point::real_length_plus_normize方法的典型用法代码示例。如果您正苦于以下问题:C++ IVP_U_Float_Point::real_length_plus_normize方法的具体用法?C++ IVP_U_Float_Point::real_length_plus_normize怎么用?C++ IVP_U_Float_Point::real_length_plus_normize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVP_U_Float_Point
的用法示例。
在下文中一共展示了IVP_U_Float_Point::real_length_plus_normize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MaxSpeed
void CShadowController::MaxSpeed( const Vector &velocity, const AngularImpulse &angularVelocity )
{
IVP_Core *pCore = m_pObject->GetObject()->get_core();
// limit additional velocity to that which is not amplifying the current velocity
IVP_U_Float_Point ivpVel;
ConvertPositionToIVP( velocity, ivpVel );
IVP_U_Float_Point available = ivpVel;
m_currentSpeed = ivpVel;
// normalize and save length
float length = ivpVel.real_length_plus_normize();
float dot = ivpVel.dot_product( &pCore->speed );
if ( dot > 0 )
{
ivpVel.mult( dot * length );
available.subtract( &ivpVel );
}
IVP_Float_PointAbs( m_shadow.maxSpeed, available );
// same for angular, project on to current and remove redundant (amplifying) input
IVP_U_Float_Point ivpAng;
ConvertAngularImpulseToIVP( angularVelocity, ivpAng );
IVP_U_Float_Point availableAng = ivpAng;
float lengthAng = ivpAng.real_length_plus_normize();
float dotAng = ivpAng.dot_product( &pCore->rot_speed );
if ( dotAng > 0 )
{
ivpAng.mult( dotAng * lengthAng );
availableAng.subtract( &ivpAng );
}
IVP_Float_PointAbs( m_shadow.maxAngular, availableAng );
}