本文整理汇总了C++中IVP_U_Float_Point::mult方法的典型用法代码示例。如果您正苦于以下问题:C++ IVP_U_Float_Point::mult方法的具体用法?C++ IVP_U_Float_Point::mult怎么用?C++ IVP_U_Float_Point::mult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVP_U_Float_Point
的用法示例。
在下文中一共展示了IVP_U_Float_Point::mult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 );
}
示例2: ApplyForceCenter
// Apply force impulse (momentum) to the object
void CPhysicsObject::ApplyForceCenter( const Vector &forceVector )
{
// Assert(IsMoveable());
if ( !IsMoveable() )
return;
IVP_U_Float_Point tmp;
ConvertForceImpulseToIVP( forceVector, tmp );
IVP_Core *core = m_pObject->get_core();
tmp.mult( core->get_inv_mass() );
tmp.k[0] = clamp( tmp.k[0], -MAX_SPEED, MAX_SPEED );
tmp.k[1] = clamp( tmp.k[1], -MAX_SPEED, MAX_SPEED );
tmp.k[2] = clamp( tmp.k[2], -MAX_SPEED, MAX_SPEED );
m_pObject->async_add_speed_object_ws( &tmp );
}
示例3: DoSimulationTurbine
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void IVP_Controller_Raycast_Airboat::DoSimulationTurbine(IVP_Event_Sim *pEventSim)
{
IVP_Core *pAirboatCore = m_pAirboatBody->get_core();
IVP_FLOAT thrust = m_flThrust;
if (m_bAirborneIdle || (m_bAirborne && (thrust < 0.0f)))
thrust *= 0.5f;
IVP_U_Float_Point vecImpulse;
pAirboatCore->get_m_world_f_core_PSI()->get_col(IVP_COORDINATE_INDEX(index_z), &vecImpulse);
IVP_FLOAT flForwardY = vecImpulse.k[1];
if ((flForwardY < -0.5f) && (thrust > 0.0f))
thrust *= 1.0f + flForwardY;
else if ((flForwardY > 0.5f) && (thrust < 0.0f))
thrust *= 1.0f - flForwardY;
vecImpulse.mult(pAirboatCore->get_mass() * thrust * pEventSim->delta_time);
pAirboatCore->center_push_core_multiple_ws(&vecImpulse);
}