Bullet Collision Detection & Physics Library
btRaycastVehicle.h
Go to the documentation of this file.
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 BT_RAYCASTVEHICLE_H
12#define BT_RAYCASTVEHICLE_H
13
16#include "btVehicleRaycaster.h"
17class btDynamicsWorld;
19#include "btWheelInfo.h"
21
22//class btVehicleTuning;
23
26{
27
32
36
37public:
39 {
40 public:
41
49 {
50 }
57
58 };
59private:
60
65
67
71
73
74public:
75
76 //constructor to create a car from an existing rigidbody
78
79 virtual ~btRaycastVehicle() ;
80
81
84 {
87 }
88
89
92
94
96
97 virtual void updateVehicle(btScalar step);
98
99
100 void resetSuspension();
101
103
105
106
108
109 const btTransform& getWheelTransformWS( int wheelIndex ) const;
110
112
113// void setRaycastWheelInfo( int wheelIndex , bool isInContact, const btVector3& hitPoint, const btVector3& hitNormal,btScalar depth);
114
116
117 inline int getNumWheels() const {
118 return int (m_wheelInfo.size());
119 }
120
122
123
124 const btWheelInfo& getWheelInfo(int index) const;
125
126 btWheelInfo& getWheelInfo(int index);
127
129
130
132
134 {
136 }
137
139
140 virtual void updateFriction(btScalar timeStep);
141
142
143
145 {
146 return m_chassisBody;
147 }
148
150 {
151 return m_chassisBody;
152 }
153
154 inline int getRightAxis() const
155 {
156 return m_indexRightAxis;
157 }
158 inline int getUpAxis() const
159 {
160 return m_indexUpAxis;
161 }
162
163 inline int getForwardAxis() const
164 {
165 return m_indexForwardAxis;
166 }
167
168
171 {
173
175 chassisTrans.getBasis()[0][m_indexForwardAxis],
176 chassisTrans.getBasis()[1][m_indexForwardAxis],
177 chassisTrans.getBasis()[2][m_indexForwardAxis]);
178
179 return forwardW;
180 }
181
184 {
186 }
187
189 {
193 }
194
195
198 {
199 return m_userConstraintType ;
200 }
201
203 {
205 };
206
208 {
210 }
211
213 {
214 return m_userConstraintId;
215 }
216
217};
218
220{
222public:
224 :m_dynamicsWorld(world)
225 {
226 }
227
228 virtual void* castRay(const btVector3& from,const btVector3& to, btVehicleRaycasterResult& result);
229
230};
231
232
233#endif //BT_RAYCASTVEHICLE_H
234
const T & btMax(const T &a, const T &b)
Definition btMinMax.h:29
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:292
Basic interface to allow actions such as vehicles and characters to be updated inside a btDynamicsWor...
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int size() const
return the number of elements in the array
CollisionWorld is interface and container for the collision detection.
virtual void * castRay(const btVector3 &from, const btVector3 &to, btVehicleRaycasterResult &result)
btDefaultVehicleRaycaster(btDynamicsWorld *world)
btDynamicsWorld * m_dynamicsWorld
The btDynamicsWorld is the interface class for several dynamics implementation, basic,...
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
rayCast vehicle, very special constraint that turn a rigidbody into a vehicle.
btAlignedObjectArray< btVector3 > m_forwardWS
virtual void updateFriction(btScalar timeStep)
void defaultInit(const btVehicleTuning &tuning)
void updateWheelTransformsWS(btWheelInfo &wheel, bool interpolatedTransform=true)
int getUserConstraintType() const
backwards compatibility
virtual void updateAction(btCollisionWorld *collisionWorld, btScalar step)
btActionInterface interface
btVector3 getForwardVector() const
Worldspace forward vector.
btRigidBody * getRigidBody()
btAlignedObjectArray< btScalar > m_sideImpulse
const btTransform & getWheelTransformWS(int wheelIndex) const
int getNumWheels() const
int getUserConstraintId() const
virtual void setCoordinateSystem(int rightIndex, int upIndex, int forwardIndex)
btScalar m_currentVehicleSpeedKmHour
btScalar rayCast(btWheelInfo &wheel)
int m_userConstraintType
backwards compatibility
void setUserConstraintType(int userConstraintType)
btScalar getSteeringValue(int wheel) const
const btRigidBody * getRigidBody() const
void setBrake(btScalar brake, int wheelIndex)
void updateSuspension(btScalar deltaTime)
btAlignedObjectArray< btVector3 > m_axle
btRaycastVehicle(const btVehicleTuning &tuning, btRigidBody *chassis, btVehicleRaycaster *raycaster)
int getRightAxis() const
btVehicleRaycaster * m_vehicleRaycaster
virtual void updateVehicle(btScalar step)
btAlignedObjectArray< btScalar > m_forwardImpulse
btAlignedObjectArray< btWheelInfo > m_wheelInfo
btRigidBody * m_chassisBody
void applyEngineForce(btScalar force, int wheel)
void setPitchControl(btScalar pitch)
btWheelInfo & addWheel(const btVector3 &connectionPointCS0, const btVector3 &wheelDirectionCS0, const btVector3 &wheelAxleCS, btScalar suspensionRestLength, btScalar wheelRadius, const btVehicleTuning &tuning, bool isFrontWheel)
void debugDraw(btIDebugDraw *debugDrawer)
btActionInterface interface
int getForwardAxis() const
void setUserConstraintId(int uid)
const btTransform & getChassisWorldTransform() const
void updateWheelTransform(int wheelIndex, bool interpolatedTransform=true)
const btWheelInfo & getWheelInfo(int index) const
btScalar getCurrentSpeedKmHour() const
Velocity of vehicle (positive if velocity vector has same direction as foward vector)
void setSteeringValue(btScalar steering, int wheel)
The btRigidBody is the main class for rigid body objects.
Definition btRigidBody.h:63
The btTransform class supports rigid transforms with only translation and rotation and no scaling/she...
Definition btTransform.h:34
btVector3 can be used to represent 3D points and vectors.
Definition btVector3.h:84
btVehicleRaycaster is provides interface for between vehicle simulation and raycasting
btWheelInfo contains information per wheel about friction and suspension.
Definition btWheelInfo.h:39