Bullet Collision Detection & Physics Library
btWheelInfo.cpp
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 #include "btWheelInfo.h"
12 #include "BulletDynamics/Dynamics/btRigidBody.h" // for pointvelocity
13 
14 
16 {
17 
19 
20 }
21 
22 void btWheelInfo::updateWheel(const btRigidBody& chassis,RaycastInfo& raycastInfo)
23 {
24  (void)raycastInfo;
25 
26 
28 
29  {
31  btVector3 chassis_velocity_at_contactPoint;
33  chassis_velocity_at_contactPoint = chassis.getVelocityInLocalPoint( relpos );
34  btScalar projVel = m_raycastInfo.m_contactNormalWS.dot( chassis_velocity_at_contactPoint );
35  if ( project >= btScalar(-0.1))
36  {
39  }
40  else
41  {
42  btScalar inv = btScalar(-1.) / project;
43  m_suspensionRelativeVelocity = projVel * inv;
45  }
46 
47  }
48 
49  else // Not in contact : position wheel in a nice (rest length) position
50  {
55  }
56 }