Bullet Collision Detection & Physics Library: btWheelInfo.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btWheelInfo.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005 Erwin Coumans https://bulletphysics.org
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 BT_WHEEL_INFO_H
12#define BT_WHEEL_INFO_H
13
14#include "LinearMath/btVector3.h"
15#include "LinearMath/btTransform.h"
16
17class btRigidBody;
18
19 struct 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 btScalar m_maxSuspensionForce;
33 bool m_bIsFrontWheel;
34};
35
37 struct 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 btScalar m_maxSuspensionForce;
72
73 btScalar m_engineForce;
74
75 btScalar m_brake;
76
77 bool m_bIsFrontWheel;
78
79 void* m_clientInfo; //can be used to store pointer to sync transforms...
80
81 btWheelInfo() {}
82
83 btWheelInfo(btWheelInfoConstructionInfo& ci)
84
85 {
86 m_suspensionRestLength1 = ci.m_suspensionRestLength;
87 m_maxSuspensionTravelCm = ci.m_maxSuspensionTravelCm;
88
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;
105 }
106
107 void updateWheel(const btRigidBody& chassis, RaycastInfo& raycastInfo);
108
109 btScalar m_clippedInvContactDotSuspension;
110 btScalar m_suspensionRelativeVelocity;
111 //calculated by suspension
112 btScalar m_wheelsSuspensionForce;
113 btScalar m_skidInfo;
114};
115
116#endif //BT_WHEEL_INFO_H
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btTransform.h
btVector3.h
btRigidBody
The btRigidBody is the main class for rigid body objects.
Definition: btRigidBody.h:60
btTransform
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition: btTransform.h:30
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition: btVector3.h:82
btWheelInfoConstructionInfo
Definition: btWheelInfo.h:20
btWheelInfoConstructionInfo::m_suspensionRestLength
btScalar m_suspensionRestLength
Definition: btWheelInfo.h:24
btWheelInfoConstructionInfo::m_wheelsDampingRelaxation
btScalar m_wheelsDampingRelaxation
Definition: btWheelInfo.h:30
btWheelInfoConstructionInfo::m_wheelAxleCS
btVector3 m_wheelAxleCS
Definition: btWheelInfo.h:23
btWheelInfoConstructionInfo::m_wheelDirectionCS
btVector3 m_wheelDirectionCS
Definition: btWheelInfo.h:22
btWheelInfoConstructionInfo::m_bIsFrontWheel
bool m_bIsFrontWheel
Definition: btWheelInfo.h:33
btWheelInfoConstructionInfo::m_wheelsDampingCompression
btScalar m_wheelsDampingCompression
Definition: btWheelInfo.h:29
btWheelInfoConstructionInfo::m_frictionSlip
btScalar m_frictionSlip
Definition: btWheelInfo.h:31
btWheelInfoConstructionInfo::m_maxSuspensionForce
btScalar m_maxSuspensionForce
Definition: btWheelInfo.h:32
btWheelInfoConstructionInfo::m_wheelRadius
btScalar m_wheelRadius
Definition: btWheelInfo.h:26
btWheelInfoConstructionInfo::m_maxSuspensionTravelCm
btScalar m_maxSuspensionTravelCm
Definition: btWheelInfo.h:25
btWheelInfoConstructionInfo::m_suspensionStiffness
btScalar m_suspensionStiffness
Definition: btWheelInfo.h:28
btWheelInfoConstructionInfo::m_chassisConnectionCS
btVector3 m_chassisConnectionCS
Definition: btWheelInfo.h:21
btWheelInfo::RaycastInfo
Definition: btWheelInfo.h:40
btWheelInfo::RaycastInfo::m_wheelAxleWS
btVector3 m_wheelAxleWS
Definition: btWheelInfo.h:47
btWheelInfo::RaycastInfo::m_suspensionLength
btScalar m_suspensionLength
Definition: btWheelInfo.h:44
btWheelInfo::RaycastInfo::m_contactPointWS
btVector3 m_contactPointWS
Definition: btWheelInfo.h:43
btWheelInfo::RaycastInfo::m_isInContact
bool m_isInContact
Definition: btWheelInfo.h:48
btWheelInfo::RaycastInfo::m_wheelDirectionWS
btVector3 m_wheelDirectionWS
Definition: btWheelInfo.h:46
btWheelInfo::RaycastInfo::m_hardPointWS
btVector3 m_hardPointWS
Definition: btWheelInfo.h:45
btWheelInfo::RaycastInfo::m_groundObject
void * m_groundObject
Definition: btWheelInfo.h:49
btWheelInfo::RaycastInfo::m_contactNormalWS
btVector3 m_contactNormalWS
Definition: btWheelInfo.h:42
btWheelInfo
btWheelInfo contains information per wheel about friction and suspension.
Definition: btWheelInfo.h:38
btWheelInfo::m_clippedInvContactDotSuspension
btScalar m_clippedInvContactDotSuspension
Definition: btWheelInfo.h:109
btWheelInfo::m_skidInfo
btScalar m_skidInfo
Definition: btWheelInfo.h:113
btWheelInfo::updateWheel
void updateWheel(const btRigidBody &chassis, RaycastInfo &raycastInfo)
Definition: btWheelInfo.cpp:19
btWheelInfo::m_suspensionStiffness
btScalar m_suspensionStiffness
Definition: btWheelInfo.h:63
btWheelInfo::m_wheelDirectionCS
btVector3 m_wheelDirectionCS
Definition: btWheelInfo.h:57
btWheelInfo::getSuspensionRestLength
btScalar getSuspensionRestLength() const
Definition: btWheelInfo.cpp:14
btWheelInfo::m_suspensionRestLength1
btScalar m_suspensionRestLength1
Definition: btWheelInfo.h:59
btWheelInfo::m_maxSuspensionForce
btScalar m_maxSuspensionForce
Definition: btWheelInfo.h:71
btWheelInfo::m_rotation
btScalar m_rotation
Definition: btWheelInfo.h:68
btWheelInfo::m_maxSuspensionTravelCm
btScalar m_maxSuspensionTravelCm
Definition: btWheelInfo.h:60
btWheelInfo::m_steering
btScalar m_steering
Definition: btWheelInfo.h:67
btWheelInfo::m_wheelsSuspensionForce
btScalar m_wheelsSuspensionForce
Definition: btWheelInfo.h:112
btWheelInfo::m_wheelsRadius
btScalar m_wheelsRadius
Definition: btWheelInfo.h:62
btWheelInfo::m_bIsFrontWheel
bool m_bIsFrontWheel
Definition: btWheelInfo.h:77
btWheelInfo::m_rollInfluence
btScalar m_rollInfluence
Definition: btWheelInfo.h:70
btWheelInfo::m_chassisConnectionPointCS
btVector3 m_chassisConnectionPointCS
Definition: btWheelInfo.h:56
btWheelInfo::m_clientInfo
void * m_clientInfo
Definition: btWheelInfo.h:79
btWheelInfo::m_brake
btScalar m_brake
Definition: btWheelInfo.h:75
btWheelInfo::m_wheelsDampingCompression
btScalar m_wheelsDampingCompression
Definition: btWheelInfo.h:64
btWheelInfo::m_wheelAxleCS
btVector3 m_wheelAxleCS
Definition: btWheelInfo.h:58
btWheelInfo::m_suspensionRelativeVelocity
btScalar m_suspensionRelativeVelocity
Definition: btWheelInfo.h:110
btWheelInfo::btWheelInfo
btWheelInfo()
Definition: btWheelInfo.h:81
btWheelInfo::m_deltaRotation
btScalar m_deltaRotation
Definition: btWheelInfo.h:69
btWheelInfo::m_frictionSlip
btScalar m_frictionSlip
Definition: btWheelInfo.h:66
btWheelInfo::m_wheelsDampingRelaxation
btScalar m_wheelsDampingRelaxation
Definition: btWheelInfo.h:65
btWheelInfo::btWheelInfo
btWheelInfo(btWheelInfoConstructionInfo &ci)
Definition: btWheelInfo.h:83
btWheelInfo::m_worldTransform
btTransform m_worldTransform
Definition: btWheelInfo.h:54
btWheelInfo::m_raycastInfo
RaycastInfo m_raycastInfo
Definition: btWheelInfo.h:52
btWheelInfo::m_engineForce
btScalar m_engineForce
Definition: btWheelInfo.h:73