当前位置: 首页>>代码示例>>C++>>正文


C++ IVP_U_Float_Point::set方法代码示例

本文整理汇总了C++中IVP_U_Float_Point::set方法的典型用法代码示例。如果您正苦于以下问题:C++ IVP_U_Float_Point::set方法的具体用法?C++ IVP_U_Float_Point::set怎么用?C++ IVP_U_Float_Point::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVP_U_Float_Point的用法示例。


在下文中一共展示了IVP_U_Float_Point::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SweepLedgeTree_r

void CTraceSolverSweptObject::SweepLedgeTree_r( const IVP_Compact_Ledgetree_Node *node )
{
    // Recursive function
    // Check whether ray hits the ledge tree node sphere
    IVP_U_Float_Point center; center.set( node->center.k);
	
	if ( !SweepHitsSphereOS( &center, node->radius ) )
		return;

	if ( node->is_terminal() == IVP_TRUE )
	{
		const IVP_Compact_Ledge *ledge = node->get_compact_ledge();
		unsigned int ledgeContents = m_pConvexInfo->GetContents( ledge->get_client_data() );
		if ( m_contentsMask & ledgeContents )
		{
			m_obstacle->SetLedge( ledge );
			if ( SweepSingleConvex() )
			{
				float fraction = m_pTotalTrace->fraction * m_trace.fraction;
				*m_pTotalTrace = m_trace;
				m_pTotalTrace->fraction = fraction;
				m_ray->Reset( m_ray->m_length * m_trace.fraction );

				// Update OS ray to limit tests
				m_rayCenterOS.add_multiple( &m_rayStartOS, &m_rayDirOS, m_ray->m_length*0.5f );
				m_rayEndOS.add_multiple( &m_rayStartOS,  &m_rayDirOS, m_ray->m_length );
				m_rayLengthOS = m_ray->m_length;
				m_pTotalTrace->contents = ledgeContents;
			}
		}
	
		return;
    }
    
    // check nodes children
    SweepLedgeTree_r(node->left_son());
    SweepLedgeTree_r(node->right_son());
}
开发者ID:RaisingTheDerp,项目名称:raisingthebar,代码行数:38,代码来源:trace.cpp

示例2: DoSimulationSteering

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void IVP_Controller_Raycast_Airboat::DoSimulationSteering(IVP_Event_Sim *pEventSim)
{
	IVP_Core *pAirboatCore = m_pAirboatBody->get_core();

	if ((m_SteeringAngle == 0.0f) || (m_flThrust != 0.0f))
	{
		if (m_bAnalogSteering)
		{
			if (m_flThrust < -2.0f)
				m_bReverseSteering = IVP_TRUE;
			else if ((m_flThrust > 2.0f) || (m_LocalVelocity.k[2] > 0.0f))
				m_bReverseSteering = IVP_FALSE;
		}
		else
		{
			if (m_flThrust < 0.0f)
				m_bReverseSteering = IVP_TRUE;
			else if ((m_flThrust > 0.0f) || (m_LocalVelocity.k[2] > 0.0f))
				m_bReverseSteering = IVP_FALSE;
		}
	}

	IVP_FLOAT flForceRotational;
	IVP_FLOAT flSteeringSign;
	IVP_FLOAT flMass = pAirboatCore->get_mass();

	if (fabsf(m_SteeringAngle) > 0.01)
	{
		flSteeringSign = (m_SteeringAngle < 0.0f ? -1.0f : 1.0f);
		if (m_bReverseSteering)
			flSteeringSign = -flSteeringSign;
		IVP_FLOAT flLastSign = (m_LastForwardSteeringAngle < 0.0f ? -1.0f : 1.0f);
		if ((fabsf(m_LastForwardSteeringAngle) < 0.01) || (flSteeringSign != flLastSign))
			m_SteeringSpeed = 0.0f;

		flForceRotational = (m_bAnalogSteering ? fabsf(m_SteeringAngle) : m_SteeringSpeed) * 2.0f;
		if (flForceRotational < 0.0f)
			flForceRotational = 0.0f;
		else if (flForceRotational > 1.0f)
			flForceRotational = 1.0f;
		flForceRotational = flForceRotational * IVP_RAYCAST_AIRBOAT_STEERING_RATE + (IVP_RAYCAST_AIRBOAT_STEERING_RATE * 0.25f);
		flForceRotational *= -(flMass * pEventSim->i_delta_time * flSteeringSign);
		m_SteeringSpeed += pEventSim->delta_time;
	}
	else
	{
		flForceRotational = 0.0f;
	}

	m_LastForwardSteeringAngle = m_SteeringAngle;
	if (m_bReverseSteering)
		m_LastForwardSteeringAngle = -m_LastForwardSteeringAngle;

	IVP_FLOAT flRotSpeed = pAirboatCore->rot_speed.k[1];
	flSteeringSign = (flRotSpeed < 0.0f ? -1.0f : 1.0f);

	IVP_FLOAT flForceImpulse = flMass * pEventSim->i_delta_time * flSteeringSign;
	flForceRotational += 0.0004f * flRotSpeed * flRotSpeed * flForceImpulse;
	flForceRotational += 0.001f * fabsf(flRotSpeed) * flForceImpulse;

	IVP_U_Float_Point vecAngularImpulse;
	vecAngularImpulse.set(0.0f, -flForceRotational, 0.0f);
	pAirboatCore->rot_push_core_cs(&vecAngularImpulse);
}
开发者ID:TrentSterling,项目名称:D0G,代码行数:67,代码来源:ivp_controller_airboat.cpp


注:本文中的IVP_U_Float_Point::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。