本文整理汇总了C++中IVP_U_Float_Point::add方法的典型用法代码示例。如果您正苦于以下问题:C++ IVP_U_Float_Point::add方法的具体用法?C++ IVP_U_Float_Point::add怎么用?C++ IVP_U_Float_Point::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVP_U_Float_Point
的用法示例。
在下文中一共展示了IVP_U_Float_Point::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetVelocity
void CPhysicsObject::GetVelocity( Vector *velocity, AngularImpulse *angularVelocity )
{
if ( !velocity && !angularVelocity )
return;
IVP_Core *core = m_pObject->get_core();
if ( velocity )
{
IVP_U_Float_Point speed;
speed.add( &core->speed, &core->speed_change );
ConvertPositionToHL( speed, *velocity );
}
if ( angularVelocity )
{
IVP_U_Float_Point rotSpeed;
rotSpeed.add( &core->rot_speed, &core->rot_speed_change );
// xform to HL space
ConvertAngularImpulseToHL( rotSpeed, *angularVelocity );
}
}
示例2: GetVelocityAtPoint
void CPhysicsObject::GetVelocityAtPoint( const Vector &worldPosition, Vector &velocity )
{
IVP_Core *core = m_pObject->get_core();
IVP_U_Point pos;
ConvertPositionToIVP( worldPosition, pos );
IVP_U_Float_Point rotSpeed;
rotSpeed.add( &core->rot_speed, &core->rot_speed_change );
IVP_U_Float_Point av_ws;
core->get_m_world_f_core_PSI()->vmult3( &rotSpeed, &av_ws);
IVP_U_Float_Point pos_rel;
pos_rel.subtract( &pos, core->get_position_PSI());
IVP_U_Float_Point cross;
cross.inline_calc_cross_product(&av_ws,&pos_rel);
IVP_U_Float_Point speed;
speed.add(&core->speed, &cross);
speed.add(&core->speed_change);
ConvertPositionToHL( speed, velocity );
}
示例3: ComputeController
void ComputeController( IVP_U_Float_Point ¤tSpeed, const IVP_U_Float_Point &delta, const IVP_U_Float_Point &maxSpeed, float scaleDelta, float damping )
{
// scale by timestep
IVP_U_Float_Point acceleration;
acceleration.set_multiple( &delta, scaleDelta );
if ( currentSpeed.quad_length() < 1e-6 )
{
currentSpeed.set_to_zero();
}
acceleration.add_multiple( ¤tSpeed, -damping );
for(int i=2; i>=0; i--)
{
if(IVP_Inline_Math::fabsd(acceleration.k[i]) < maxSpeed.k[i])
continue;
// clip force
acceleration.k[i] = (acceleration.k[i] < 0) ? -maxSpeed.k[i] : maxSpeed.k[i];
}
currentSpeed.add( &acceleration );
}