Back to index

supertuxkart  0.5+dfsg1
btWheelInfo.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
00003  *
00004  * Permission to use, copy, modify, distribute and sell this software
00005  * and its documentation for any purpose is hereby granted without fee,
00006  * provided that the above copyright notice appear in all copies.
00007  * Erwin Coumans makes no representations about the suitability 
00008  * of this software for any purpose.  
00009  * It is provided "as is" without express or implied warranty.
00010 */
00011 #ifndef WHEEL_INFO_H
00012 #define WHEEL_INFO_H
00013 
00014 #include "LinearMath/btVector3.h"
00015 #include "LinearMath/btTransform.h"
00016 
00017 class btRigidBody;
00018 
00019 struct btWheelInfoConstructionInfo
00020 {
00021        btVector3     m_chassisConnectionCS;
00022        btVector3     m_wheelDirectionCS;
00023        btVector3     m_wheelAxleCS;
00024        btScalar      m_suspensionRestLength;
00025        btScalar      m_maxSuspensionTravelCm;
00026        btScalar      m_wheelRadius;
00027        
00028        btScalar             m_suspensionStiffness;
00029        btScalar             m_wheelsDampingCompression;
00030        btScalar             m_wheelsDampingRelaxation;
00031        btScalar             m_frictionSlip;
00032        bool m_bIsFrontWheel;
00033        
00034 };
00035 
00037 struct btWheelInfo
00038 {
00039        struct RaycastInfo
00040        {
00041               //set by raycaster
00042               btVector3     m_contactNormalWS;//contactnormal
00043               btVector3     m_contactPointWS;//raycast hitpoint
00044               btScalar      m_suspensionLength;
00045               btVector3     m_hardPointWS;//raycast starting point
00046               btVector3     m_wheelDirectionWS; //direction in worldspace
00047               btVector3     m_wheelAxleWS; // axle in worldspace
00048               bool          m_isInContact;
00049               void*         m_groundObject; //could be general void* ptr
00050        };
00051 
00052        RaycastInfo   m_raycastInfo;
00053 
00054        btTransform   m_worldTransform;
00055        
00056        btVector3     m_chassisConnectionPointCS; //const
00057        btVector3     m_wheelDirectionCS;//const
00058        btVector3     m_wheelAxleCS; // const or modified by steering
00059        btScalar      m_suspensionRestLength1;//const
00060        btScalar      m_maxSuspensionTravelCm;
00061        btScalar getSuspensionRestLength() const;
00062        btScalar      m_wheelsRadius;//const
00063        btScalar      m_suspensionStiffness;//const
00064        btScalar      m_wheelsDampingCompression;//const
00065        btScalar      m_wheelsDampingRelaxation;//const
00066        btScalar      m_frictionSlip;
00067        btScalar      m_steering;
00068        btScalar      m_rotation;
00069        btScalar      m_deltaRotation;
00070        btScalar      m_rollInfluence;
00071 
00072        btScalar      m_engineForce;
00073 
00074        btScalar      m_brake;
00075        
00076        bool m_bIsFrontWheel;
00077        
00078        void*         m_clientInfo;//can be used to store pointer to sync transforms...
00079 
00080        btWheelInfo(btWheelInfoConstructionInfo& ci)
00081 
00082        {
00083 
00084               m_suspensionRestLength1 = ci.m_suspensionRestLength;
00085               m_maxSuspensionTravelCm = ci.m_maxSuspensionTravelCm;
00086 
00087               m_wheelsRadius = ci.m_wheelRadius;
00088               m_suspensionStiffness = ci.m_suspensionStiffness;
00089               m_wheelsDampingCompression = ci.m_wheelsDampingCompression;
00090               m_wheelsDampingRelaxation = ci.m_wheelsDampingRelaxation;
00091               m_chassisConnectionPointCS = ci.m_chassisConnectionCS;
00092               m_wheelDirectionCS = ci.m_wheelDirectionCS;
00093               m_wheelAxleCS = ci.m_wheelAxleCS;
00094               m_frictionSlip = ci.m_frictionSlip;
00095               m_steering = btScalar(0.);
00096               m_engineForce = btScalar(0.);
00097               m_rotation = btScalar(0.);
00098               m_deltaRotation = btScalar(0.);
00099               m_brake = btScalar(0.);
00100               m_rollInfluence = btScalar(0.1);
00101               m_bIsFrontWheel = ci.m_bIsFrontWheel;
00102 
00103        }
00104 
00105        void   updateWheel(const btRigidBody& chassis,RaycastInfo& raycastInfo);
00106 
00107        btScalar      m_clippedInvContactDotSuspension;
00108        btScalar      m_suspensionRelativeVelocity;
00109        //calculated by suspension
00110        btScalar      m_wheelsSuspensionForce;
00111        btScalar      m_skidInfo;
00112 
00113 };
00114 
00115 #endif //WHEEL_INFO_H
00116