2 * Copyright (c) 2005 Erwin Coumans https://bulletphysics.org
4 * Permission to use, copy, modify, distribute and sell this software
5 * and its documentation for any purpose is hereby granted without fee,
6 * provided that the above copyright notice appear in all copies.
7 * Erwin Coumans makes no representations about the suitability
8 * of this software for any purpose.
9 * It is provided "as is" without express or implied warranty.
11 #ifndef BT_WHEEL_INFO_H
12 #define BT_WHEEL_INFO_H
14 #include "LinearMath/btVector3.h"
15 #include "LinearMath/btTransform.h"
19 struct btWheelInfoConstructionInfo
21 btVector3 m_chassisConnectionCS;
22 btVector3 m_wheelDirectionCS;
23 btVector3 m_wheelAxleCS;
24 btScalar m_suspensionRestLength;
25 btScalar m_maxSuspensionTravelCm;
26 btScalar m_wheelRadius;
28 btScalar m_suspensionStiffness;
29 btScalar m_wheelsDampingCompression;
30 btScalar m_wheelsDampingRelaxation;
31 btScalar m_frictionSlip;
32 btScalar m_maxSuspensionForce;
36 /// btWheelInfo contains information per wheel about friction and suspension.
42 btVector3 m_contactNormalWS; //contactnormal
43 btVector3 m_contactPointWS; //raycast hitpoint
44 btScalar m_suspensionLength;
45 btVector3 m_hardPointWS; //raycast starting point
46 btVector3 m_wheelDirectionWS; //direction in worldspace
47 btVector3 m_wheelAxleWS; // axle in worldspace
49 void* m_groundObject; //could be general void* ptr
52 RaycastInfo m_raycastInfo;
54 btTransform m_worldTransform;
56 btVector3 m_chassisConnectionPointCS; //const
57 btVector3 m_wheelDirectionCS; //const
58 btVector3 m_wheelAxleCS; // const or modified by steering
59 btScalar m_suspensionRestLength1; //const
60 btScalar m_maxSuspensionTravelCm;
61 btScalar getSuspensionRestLength() const;
62 btScalar m_wheelsRadius; //const
63 btScalar m_suspensionStiffness; //const
64 btScalar m_wheelsDampingCompression; //const
65 btScalar m_wheelsDampingRelaxation; //const
66 btScalar m_frictionSlip;
69 btScalar m_deltaRotation;
70 btScalar m_rollInfluence;
71 btScalar m_maxSuspensionForce;
73 btScalar m_engineForce;
79 void* m_clientInfo; //can be used to store pointer to sync transforms...
83 btWheelInfo(btWheelInfoConstructionInfo& ci)
86 m_suspensionRestLength1 = ci.m_suspensionRestLength;
87 m_maxSuspensionTravelCm = ci.m_maxSuspensionTravelCm;
89 m_wheelsRadius = ci.m_wheelRadius;
90 m_suspensionStiffness = ci.m_suspensionStiffness;
91 m_wheelsDampingCompression = ci.m_wheelsDampingCompression;
92 m_wheelsDampingRelaxation = ci.m_wheelsDampingRelaxation;
93 m_chassisConnectionPointCS = ci.m_chassisConnectionCS;
94 m_wheelDirectionCS = ci.m_wheelDirectionCS;
95 m_wheelAxleCS = ci.m_wheelAxleCS;
96 m_frictionSlip = ci.m_frictionSlip;
97 m_steering = btScalar(0.);
98 m_engineForce = btScalar(0.);
99 m_rotation = btScalar(0.);
100 m_deltaRotation = btScalar(0.);
101 m_brake = btScalar(0.);
102 m_rollInfluence = btScalar(0.1);
103 m_bIsFrontWheel = ci.m_bIsFrontWheel;
104 m_maxSuspensionForce = ci.m_maxSuspensionForce;
107 void updateWheel(const btRigidBody& chassis, RaycastInfo& raycastInfo);
109 btScalar m_clippedInvContactDotSuspension;
110 btScalar m_suspensionRelativeVelocity;
111 //calculated by suspension
112 btScalar m_wheelsSuspensionForce;
116 #endif //BT_WHEEL_INFO_H