Closed Hjaltesorgenfrei closed 1 year ago
The problem seems to be that surfNormalWS gets a coordinate of -1 in the first position.
When surfNormalWS.m_floats[0] == -1
, it crashes due to m_axle[i] -= surfNormalWS * proj
.
This value gets assigned at https://github.com/bulletphysics/bullet3/blob/0e59474e1cf1fd69e3ca512826cfbe15cd6a9cec/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp#L187
Which is in turn assigned from btDefaultVehicleRaycaster::castRay
, where a rayCallback.m_hitNormalWorld = (-1, 9.65595e-06, 1.66297e-05)
.
But only after many steps of simulation with a ray hit result of (0, 1, 0)
.
The problem occurs even in if the only two objects in the dynamic world is a vehicle and a btStaticPlaneShape
or a btBvhTriangleMeshShape
.
It's only a small change when the normal changes to be negative, with the plane having a normal vector of (0, 1, 0)
and a planeConstant of 0.
updateWheelInfo index: 0
from: -1.19337, 0.979308, 0.83563
to: -1.19112, -0.12069, 0.83605
hit normal: 0, 1, 0
updateWheelInfo index: 0
from: -1.19376, 0.979179, 0.835647
to: -1.19151, -0.120819, 0.836047
hit normal: -0.990617, -0.00207001, -0.136649
The problem seems to be that the ray from the wheel interacts with the chassis, which causes a problem. This can be avoided by setting the 0th bit in the chassis's mask, but that does not seem like a good solution.
Fixed it by moving the wheels down 0.001f, as the chassis was a cube of size 1, and suspension was 1 long as well. Which meant they could potentially interact.
Hi, I get a crash on an assert when using
btRaycastVehicle
and runningstepSimulation
.Crash happens at: https://github.com/bulletphysics/bullet3/blob/master/src/BulletDynamics/Vehicle/btRaycastVehicle.cpp#L533 when using the source code in the current master branch.
Not every
Callstack on crash:
The crash from the assert does not happen immediately or with any consistency. But if I use the following values for the wheels the crash happens each time after the vehicle has settled after initial spawn in.
This issue occurs on both Linux 6.2.6-arch1-1 and Windows 10, when running on Intel.