I am using BulletVehicle for a motorcycle. When the bike wheelies or dives off a curb, one wheel loses contact with the ground, and it can easily spin out of control. I’d like to apply some kind of stabilization when the bike is in a wheelie/endo.
In the original Bullet library, there is a variable m_isInContact you can use to determine whether a wheel is touching an object. Is there a similar function in Panda? Or should I use a workaround?
No workaround so far. I simply missed the whole structure btWheelInfo::RaycastInfo. I will check in code which exposes this structure this evening. Thanks for pointing me at this property.
Terrific, I was just about to check. Do you know if I need to recompile everything, or can I just wait for the next build, download the SDK again, and start writing Python?
Bringing this topic back from the grave for what appears to be a bug. I set up a simple scene with a vehicle, ground plane and an object to drive over. The vehicle correctly reports whether its wheels are in contact with an object via isInContact(), but crashes the program when I try to identify the mesh with getGroundObject().
This works:
for wheel in bike.getWheels():
if wheel.getRaycastInfo().isInContact():
print 'bike on ground'
This doesn’t:
for wheel in bike.getWheels():
if wheel.getRaycastInfo().isInContact():
print 'bike touching',wheel.getRaycastInfo().getGroundObject()
Seems like the “old” implementation (that is setting groundObject to object) has been replaced by a “new” implementation which simply returns a (static) dummy rigid body. This dummy rigid body does not have a Panda3D object associated with it, and hence the crash.
I don’t know why this Bullet feature has changed. The new implementation is useless, since it doesn’t provide any information about the object the vehicle is driving on.
What should we do?
Remove the method from the Panda3D interface. This would be the “clean” solution.
Leave it there, so people who compile Bullet (and then Panda3D) themselves can change the Bullet source code back to the old implementation. Just uncomment the commented line and comment the other one.