//
// Asura_Physics_Vehicle_FourWheeled.h
//
// Created by KJFL - 13 September 2005
//
// Copyright (C) 2005 Rebellion, All Rights Reserved.
//

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __ASURA_PHYSICS_VEHICLE_FOURWHEELED_H__
#define __ASURA_PHYSICS_VEHICLE_FOURWHEELED_H__


#include "Core/Asura_Maths.h"
#include "Physics/Vehicles/Asura_Physics_Vehicle.h"

class Asura_Physics_Object;

class Asura_Physics_Vehicle_Wheel
{
	public:

		float	m_fRadius;
		float	m_fSuspensionPosition;

		float	m_fAngularVelocity;
		float	m_fAngularPosition;

		Asura_AVector3 m_xPosition;

		// some sort of contact info? 
		// bool for in contact with ground? fraction of wheel in contact, i.e. continuous rather than discrete?
		
		u_int	m_bSteerable :1;

};

class Asura_Physics_Vehicle_FourWheeled : protected Asura_Physics_Vehicle
{
	public:
		Asura_Physics_Vehicle_FourWheeled();
	

		static const u_int uNUMBER_OF_WHEELS = 4;
		
		void Initialise( Asura_Physics_Object* pxPhysicsObject );

		void Update( void );

		void DebuggingRender( void );

		void GetWheelPosition( u_int uWheel, Asura_Vector_3& xPosition ) const;

		void GetWheelOrientation( u_int uWheel, Asura_Matrix_3x3& xOrientation ) const;

		void SetSteering( float fSteering );
		void SetAccelerator( float fAccelerator );
		void SetBrake( float fBrake );


	private:

		void UpdateWheelPositions( void );

		void DebuggingRender_Wheel( Asura_Vector_3& xCentre, Asura_Matrix_3x3& xOrient, float fRadius );


		Asura_Physics_Vehicle_Wheel		m_axWheel[ uNUMBER_OF_WHEELS ];

		Asura_Physics_Object*			m_pxPhysicsObject;

		float							m_fDriveTorque;
		float							m_fAccelerator;
		float							m_fBreakingStrength;
		float							m_fSteeringAngle;
};



#endif//__ASURA_PHYSICS_VEHICLE_FOURWHEELED_H__
