00001 #ifndef _RACE_CAR_H 00002 #define _RACE_CAR_H 00003 00004 #include "MercuryODE.h" 00005 00006 class RaceCar : public MercuryODEObjectLoadable 00007 { 00008 public: 00009 RaceCar() : MercuryODEObjectLoadable() 00010 { } 00011 RaceCar( const MString & sName ) :MercuryODEObjectLoadable(sName) 00012 { SetName(sName); } 00013 00014 ~RaceCar(); 00015 virtual void Init(); 00016 virtual void PreCycleUpdate( const float dTime ); 00017 virtual bool Collide( MercuryODEObject * pHit, dContact & pContact, MercuryODEWorld * pWorld ); 00018 virtual bool LoadFromINI( MercuryINI & pINI, const MString & sShapeName, const dWorldID &oWorld ); 00019 virtual void Message( int Message, PStack & data, const MString & name ); 00020 CLASS_RTTI( RaceCar, MercuryODEObjectLoadable ); 00021 00022 void ChangeTopSpeed( float fSpeed ) { m_fSpeed = fSpeed; } 00023 void ChangeSteer( float fSteer ) { m_fSteer = fSteer; } 00024 float GetSteer( ) { return m_fSteer; } 00025 void SetBreak( bool bBreak ) { m_bBreaking = bBreak; } 00026 private: 00027 float m_fSpeed; 00028 float m_fSteer; 00029 bool m_bBreaking; 00030 MercuryODEObjectLoadable * oWheels[4]; 00031 MercuryODEObjectLoadable * oCarBody; 00032 dJointID m_Wheel[4]; 00033 }; 00034 00035 #endif 00036 00037 /* 00038 * Copyright (c) 2007, Charles Lohr 00039 * All rights reserved. 00040 * 00041 * Redistribution and use in source and binary forms, with or 00042 * without modification, are permitted provided that the following 00043 * conditions are met: 00044 * - Redistributions of source code must retain the above 00045 * copyright notice, this list of conditions and the following disclaimer. 00046 * - Redistributions in binary form must reproduce the above copyright 00047 * notice, this list of conditions and the following disclaimer in 00048 * the documentation and/or other materials provided with the distribution. 00049 * - Neither the name of the Mercury Engine nor the names of its 00050 * contributors may be used to endorse or promote products derived from 00051 * this software without specific prior written permission. 00052 * 00053 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00054 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00055 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00056 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 00057 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00058 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00059 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00060 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00061 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 00062 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00063 */