Exemplo n.º 1
0
//-----------------------------------------------------------------------------
// Purpose: Main raycast airboat simulation.
//-----------------------------------------------------------------------------
void IVP_Controller_Raycast_Airboat::do_simulation_controller( IVP_Event_Sim *pEventSim, IVP_U_Vector<IVP_Core> * )
{
    IVP_Raycast_Airboat_Pontoon_Temp	pontoonsTemp[IVP_RAYCAST_AIRBOAT_MAX_WHEELS];
    IVP_Ray_Solver_Template				raySolverTemplates[IVP_RAYCAST_AIRBOAT_MAX_WHEELS];
	IVP_Raycast_Airboat_Impact			impacts[IVP_RAYCAST_AIRBOAT_MAX_WHEELS];

	IVP_Core *pAirboatCore = m_pAirboatBody->get_core();
    const IVP_U_Matrix *matWorldFromCore = pAirboatCore->get_m_world_f_core_PSI();
	matWorldFromCore->vimult3(&(pAirboatCore->speed), &m_LocalVelocity);
    
	// Raycasts.
	PreRaycasts( raySolverTemplates, matWorldFromCore, pontoonsTemp );
	do_raycasts_gameside( n_wheels, raySolverTemplates, impacts );
	if ( !PostRaycasts( raySolverTemplates, matWorldFromCore, pontoonsTemp, impacts ) )
		return;

	// Airborne state;
	UpdateAirborneState(impacts, pEventSim);

    // Pontoons.
	DoSimulationPontoons(pontoonsTemp, impacts, pEventSim);

	// Drag (Water)
	DoSimulationDrag(pontoonsTemp, impacts, pEventSim);

	// Turbine (fan).
	DoSimulationTurbine(pEventSim);

	// Steering.
	DoSimulationSteering(pEventSim);

	// Keep upright.
	DoSimulationKeepUprightPitch(impacts, pEventSim);
	DoSimulationKeepUprightRoll(impacts, pEventSim);
}
//-----------------------------------------------------------------------------
// Purpose: Main raycast airboat simulation.
//-----------------------------------------------------------------------------
void IVP_Controller_Raycast_Airboat::do_simulation_controller( IVP_Event_Sim *pEventSim, IVP_U_Vector<IVP_Core> * )
{
    IVP_Raycast_Airboat_Pontoon_Temp	pontoonsTemp[IVP_RAYCAST_AIRBOAT_MAX_WHEELS];
    IVP_Ray_Solver_Template				raySolverTemplates[IVP_RAYCAST_AIRBOAT_MAX_WHEELS];
	IVP_Raycast_Airboat_Impact			impacts[IVP_RAYCAST_AIRBOAT_MAX_WHEELS];

	IVP_Core *pAirboatCore = m_pAirboatBody->get_core();
    const IVP_U_Matrix *matWorldFromCore = pAirboatCore->get_m_world_f_core_PSI();
    
	// Raycasts.
	PreRaycasts( raySolverTemplates, matWorldFromCore, pontoonsTemp );
	do_raycasts_gameside( n_wheels, raySolverTemplates, impacts );
	if ( !PostRaycasts( raySolverTemplates, matWorldFromCore, pontoonsTemp, impacts, pAirboatCore ) )
		return;

    // Pontoons.
	DoSimulationPontoons( pontoonsTemp, impacts, pEventSim, pAirboatCore );

	// Drag (Water)
	DoSimulationDrag( pontoonsTemp, pEventSim, pAirboatCore );

	// Turbine (fan).
	DoSimulationTurbine( pontoonsTemp, pEventSim, pAirboatCore );

	// Steering.
	DoSimulationSteering( pontoonsTemp, pAirboatCore, pEventSim );	
}