本文整理汇总了C++中IVP_U_Float_Point::normize方法的典型用法代码示例。如果您正苦于以下问题:C++ IVP_U_Float_Point::normize方法的具体用法?C++ IVP_U_Float_Point::normize怎么用?C++ IVP_U_Float_Point::normize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVP_U_Float_Point
的用法示例。
在下文中一共展示了IVP_U_Float_Point::normize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoSimulationDrag
//-----------------------------------------------------------------------------
// Purpose: Water drag.
//-----------------------------------------------------------------------------
void IVP_Controller_Raycast_Airboat::DoSimulationDrag( IVP_Raycast_Airboat_Pontoon_Temp *pTempPontoons,
IVP_Event_Sim *pEventSim, IVP_Core *pAirboatCore )
{
// Get the forward vector in world-space.
IVP_U_Float_Point vecForwardWS;
const IVP_U_Matrix *matWorldFromCore = pAirboatCore->get_m_world_f_core_PSI();
matWorldFromCore->get_col( IVP_COORDINATE_INDEX( index_z ), &vecForwardWS );
// Get the airboat speed and direction.
IVP_U_Float_Point vecAirboatDir = pAirboatCore->speed;
vecAirboatDir.normize();
IVP_FLOAT flSpeed = ( IVP_FLOAT )pAirboatCore->speed.real_length();
IVP_FLOAT flSpeed2 = flSpeed * flSpeed;
// Increase drag the more perpendicular the airboat gets to the direction of motion.
// IVP_FLOAT flDragTurnScale = vecAirboatDir.dot_product( &vecForwardWS );
// flDragTurnScale = ( 1.0f - flDragTurnScale ) + 1.0f;
// Calculate the drag.
IVP_FLOAT flDragScale = 0.5f * AIRBOAT_DRAG_COEFFICIENT * AIRBOAT_WATER_DENSITY * AIRBOAT_DRAG_SURFACE_AREA;
// flDragScale *= flDragTurnScale;
IVP_FLOAT flDrag = flSpeed2 * flDragScale;
// Apply the drag force opposite to the direction of motion.
IVP_U_Float_Point vecAirboatNegDir;
vecAirboatNegDir.set_negative( &vecAirboatDir );
// Apply the drag force.
IVP_U_Float_Point vecImpulse;
vecImpulse.set_multiple( &vecAirboatNegDir, flDrag * pEventSim->delta_time );
pAirboatCore->center_push_core_multiple_ws( &vecImpulse );
}