Blender  V3.3
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 
15 {
17 }
18 
19 void btWheelInfo::updateWheel(const btRigidBody& chassis, RaycastInfo& raycastInfo)
20 {
21  (void)raycastInfo;
22 
24 
25  {
27  btVector3 chassis_velocity_at_contactPoint;
29  chassis_velocity_at_contactPoint = chassis.getVelocityInLocalPoint(relpos);
30  btScalar projVel = m_raycastInfo.m_contactNormalWS.dot(chassis_velocity_at_contactPoint);
31  if (project >= btScalar(-0.1))
32  {
35  }
36  else
37  {
38  btScalar inv = btScalar(-1.) / project;
39  m_suspensionRelativeVelocity = projVel * inv;
41  }
42  }
43 
44  else // Not in contact : position wheel in a nice (rest length) position
45  {
50  }
51 }
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:314
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
Definition: btVector3.h:82
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
Definition: btRigidBody.h:460
const btVector3 & getCenterOfMassPosition() const
Definition: btRigidBody.h:423
SyclQueue void void size_t num_bytes void
vec_base< T, Size > project(const vec_base< T, Size > &p, const vec_base< T, Size > &v_proj)
btVector3 m_wheelDirectionWS
Definition: btWheelInfo.h:46
btScalar m_clippedInvContactDotSuspension
Definition: btWheelInfo.h:109
void updateWheel(const btRigidBody &chassis, RaycastInfo &raycastInfo)
Definition: btWheelInfo.cpp:19
btScalar getSuspensionRestLength() const
Definition: btWheelInfo.cpp:14
btScalar m_suspensionRestLength1
Definition: btWheelInfo.h:59
btScalar m_suspensionRelativeVelocity
Definition: btWheelInfo.h:110
RaycastInfo m_raycastInfo
Definition: btWheelInfo.h:52