Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/bullet/BulletDynamics/Vehicle/btWheelInfo.h @ 2890

Last change on this file since 2890 was 2662, checked in by rgrieder, 16 years ago

Merged presentation branch back to trunk.

  • Property svn:eol-style set to native
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
3 *
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.
10*/
11#ifndef WHEEL_INFO_H
12#define WHEEL_INFO_H
13
14#include "LinearMath/btVector3.h"
15#include "LinearMath/btTransform.h"
16
17class btRigidBody;
18
19struct btWheelInfoConstructionInfo
20{
21        btVector3       m_chassisConnectionCS;
22        btVector3       m_wheelDirectionCS;
23        btVector3       m_wheelAxleCS;
24        btScalar        m_suspensionRestLength;
25        btScalar        m_maxSuspensionTravelCm;
26        btScalar        m_wheelRadius;
27       
28        btScalar                m_suspensionStiffness;
29        btScalar                m_wheelsDampingCompression;
30        btScalar                m_wheelsDampingRelaxation;
31        btScalar                m_frictionSlip;
32        bool m_bIsFrontWheel;
33       
34};
35
36/// btWheelInfo contains information per wheel about friction and suspension.
37struct btWheelInfo
38{
39        struct RaycastInfo
40        {
41                //set by raycaster
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
48                bool            m_isInContact;
49                void*           m_groundObject; //could be general void* ptr
50        };
51
52        RaycastInfo     m_raycastInfo;
53
54        btTransform     m_worldTransform;
55       
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;
67        btScalar        m_steering;
68        btScalar        m_rotation;
69        btScalar        m_deltaRotation;
70        btScalar        m_rollInfluence;
71
72        btScalar        m_engineForce;
73
74        btScalar        m_brake;
75       
76        bool m_bIsFrontWheel;
77       
78        void*           m_clientInfo;//can be used to store pointer to sync transforms...
79
80        btWheelInfo(btWheelInfoConstructionInfo& ci)
81
82        {
83
84                m_suspensionRestLength1 = ci.m_suspensionRestLength;
85                m_maxSuspensionTravelCm = ci.m_maxSuspensionTravelCm;
86
87                m_wheelsRadius = ci.m_wheelRadius;
88                m_suspensionStiffness = ci.m_suspensionStiffness;
89                m_wheelsDampingCompression = ci.m_wheelsDampingCompression;
90                m_wheelsDampingRelaxation = ci.m_wheelsDampingRelaxation;
91                m_chassisConnectionPointCS = ci.m_chassisConnectionCS;
92                m_wheelDirectionCS = ci.m_wheelDirectionCS;
93                m_wheelAxleCS = ci.m_wheelAxleCS;
94                m_frictionSlip = ci.m_frictionSlip;
95                m_steering = btScalar(0.);
96                m_engineForce = btScalar(0.);
97                m_rotation = btScalar(0.);
98                m_deltaRotation = btScalar(0.);
99                m_brake = btScalar(0.);
100                m_rollInfluence = btScalar(0.1);
101                m_bIsFrontWheel = ci.m_bIsFrontWheel;
102
103        }
104
105        void    updateWheel(const btRigidBody& chassis,RaycastInfo& raycastInfo);
106
107        btScalar        m_clippedInvContactDotSuspension;
108        btScalar        m_suspensionRelativeVelocity;
109        //calculated by suspension
110        btScalar        m_wheelsSuspensionForce;
111        btScalar        m_skidInfo;
112
113};
114
115#endif //WHEEL_INFO_H
116
Note: See TracBrowser for help on using the repository browser.