1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116 | /*
* Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies.
* Erwin Coumans makes no representations about the suitability
* of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*/
#ifndef BT_WHEEL_INFO_H
#define BT_WHEEL_INFO_H
#include "LinearMath/btVector3.h"
#include "LinearMath/btTransform.h"
class btRigidBody;
struct btWheelInfoConstructionInfo
{
btVector3 m_chassisConnectionCS;
btVector3 m_wheelDirectionCS;
btVector3 m_wheelAxleCS;
btScalar m_suspensionRestLength;
btScalar m_maxSuspensionTravelCm;
btScalar m_wheelRadius;
btScalar m_suspensionStiffness;
btScalar m_wheelsDampingCompression;
btScalar m_wheelsDampingRelaxation;
btScalar m_frictionSlip;
btScalar m_maxSuspensionForce;
bool m_bIsFrontWheel;
};
/// btWheelInfo contains information per wheel about friction and suspension.
struct btWheelInfo
{
struct RaycastInfo
{
//set by raycaster
btVector3 m_contactNormalWS; //contactnormal
btVector3 m_contactPointWS; //raycast hitpoint
btScalar m_suspensionLength;
btVector3 m_hardPointWS; //raycast starting point
btVector3 m_wheelDirectionWS; //direction in worldspace
btVector3 m_wheelAxleWS; // axle in worldspace
bool m_isInContact;
void* m_groundObject; //could be general void* ptr
};
RaycastInfo m_raycastInfo;
btTransform m_worldTransform;
btVector3 m_chassisConnectionPointCS; //const
btVector3 m_wheelDirectionCS; //const
btVector3 m_wheelAxleCS; // const or modified by steering
btScalar m_suspensionRestLength1; //const
btScalar m_maxSuspensionTravelCm;
btScalar getSuspensionRestLength() const;
btScalar m_wheelsRadius; //const
btScalar m_suspensionStiffness; //const
btScalar m_wheelsDampingCompression; //const
btScalar m_wheelsDampingRelaxation; //const
btScalar m_frictionSlip;
btScalar m_steering;
btScalar m_rotation;
btScalar m_deltaRotation;
btScalar m_rollInfluence;
btScalar m_maxSuspensionForce;
btScalar m_engineForce;
btScalar m_brake;
bool m_bIsFrontWheel;
void* m_clientInfo; //can be used to store pointer to sync transforms...
btWheelInfo() {}
btWheelInfo(btWheelInfoConstructionInfo& ci)<--- Member variable 'btWheelInfo::m_raycastInfo' is not initialized in the constructor.<--- Member variable 'btWheelInfo::m_clientInfo' is not initialized in the constructor.<--- Struct 'btWheelInfo' has a constructor with 1 argument that is not explicit. [+]Struct 'btWheelInfo' has a constructor with 1 argument that is not explicit. Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided. <--- Parameter 'ci' can be declared with const
{
m_suspensionRestLength1 = ci.m_suspensionRestLength;<--- Variable 'm_suspensionRestLength1' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_suspensionRestLength1' a value by passing the value to the constructor in the initialization list.
m_maxSuspensionTravelCm = ci.m_maxSuspensionTravelCm;<--- Variable 'm_maxSuspensionTravelCm' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_maxSuspensionTravelCm' a value by passing the value to the constructor in the initialization list.
m_wheelsRadius = ci.m_wheelRadius;<--- Variable 'm_wheelsRadius' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_wheelsRadius' a value by passing the value to the constructor in the initialization list.
m_suspensionStiffness = ci.m_suspensionStiffness;<--- Variable 'm_suspensionStiffness' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_suspensionStiffness' a value by passing the value to the constructor in the initialization list.
m_wheelsDampingCompression = ci.m_wheelsDampingCompression;<--- Variable 'm_wheelsDampingCompression' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_wheelsDampingCompression' a value by passing the value to the constructor in the initialization list.
m_wheelsDampingRelaxation = ci.m_wheelsDampingRelaxation;<--- Variable 'm_wheelsDampingRelaxation' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_wheelsDampingRelaxation' a value by passing the value to the constructor in the initialization list.
m_chassisConnectionPointCS = ci.m_chassisConnectionCS;<--- Variable 'm_chassisConnectionPointCS' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_chassisConnectionPointCS' a value by passing the value to the constructor in the initialization list.
m_wheelDirectionCS = ci.m_wheelDirectionCS;<--- Variable 'm_wheelDirectionCS' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_wheelDirectionCS' a value by passing the value to the constructor in the initialization list.
m_wheelAxleCS = ci.m_wheelAxleCS;<--- Variable 'm_wheelAxleCS' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_wheelAxleCS' a value by passing the value to the constructor in the initialization list.
m_frictionSlip = ci.m_frictionSlip;<--- Variable 'm_frictionSlip' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_frictionSlip' a value by passing the value to the constructor in the initialization list.
m_steering = btScalar(0.);<--- Variable 'm_steering' is assigned in constructor body. Consider performing initialization in initialization list. [+]When an object of a class is created, the constructors of all member variables are called consecutively in the order the variables are declared, even if you don't explicitly write them to the initialization list. You could avoid assigning 'm_steering' a value by passing the value to the constructor in the initialization list.
m_engineForce = btScalar(0.);
m_rotation = btScalar(0.);
m_deltaRotation = btScalar(0.);
m_brake = btScalar(0.);
m_rollInfluence = btScalar(0.1);
m_bIsFrontWheel = ci.m_bIsFrontWheel;
m_maxSuspensionForce = ci.m_maxSuspensionForce;
}
void updateWheel(const btRigidBody& chassis, RaycastInfo& raycastInfo);
btScalar m_clippedInvContactDotSuspension;
btScalar m_suspensionRelativeVelocity;
//calculated by suspension
btScalar m_wheelsSuspensionForce;
btScalar m_skidInfo;
};
#endif //BT_WHEEL_INFO_H
|