# Bullet physics wheel confusion

So I previously had the bullet vehicle working more or less flawlessly, but when I tried to scale down my vehicle size to approximately 1/10 the size, things have not gone smoothly.

The wheels appear a distance below the vehicle, and this distance appears to scale with the value of the wheel direction.

Here is what it is now:

wheel.setWheelDirectionCs(Vec3(0, 0, -1))

If i change it to:

wheel.setWheelDirectionCs(Vec3(0, 0, -0.001))

Then the wheel appears in the right place, however the wheels fall through the floor plane.

Here is my other code for creating the wheels:

wheel = self.vehicle.createWheel()

wheel.setNode(wheelNP.node())
wheel.setChassisConnectionPointCs(Point3(x, y, z))
wheel.setFrontWheel(False)

wheel.setWheelDirectionCs(Vec3(0, 0, -0.001)) #-0.0001)) #sets the wheel forward vector #fusion360, (-X, Z, Y)
wheel.setWheelAxleCs(Vec3(dir, 0, 0)) #sets the wheel axel normal vector
wheel.setMaxSuspensionTravelCm(100) #this is not in cm....?

#wheel.setMaxSuspensionForce(0)

wheel.setSuspensionStiffness(200) #This fixed something

wheel.setWheelsDampingRelaxation(2.3)
wheel.setWheelsDampingCompression(4.4)
wheel.setFrictionSlip(200)
wheel.setRollInfluence(0.4)

I’m sure I am missing something with regard to how this is all intended to work, but I don’t understand why the wheel direction vector would appear to move the wheel itself. If someone could help point me in the right direction i would really appreciate it, I’m a bit stuck. Thanks!!

I believe you may be mixing up the position of the wheel (an actual location) and the “forward vector” of the wheel, which is described by an integer.

Here’s an example of more standard usage from our game Sandastray. Notice the wheel positions are defined in a list, not the wheel direction vector.

wheel = sandboard.create_wheel()
wheel.set_chassis_connection_point_cs(pos)
wheel.set_front_wheel(front_wheel)
wheel.set_wheel_direction_cs(Vec3(0, 0, -1))
wheel.set_wheel_axle_cs(Vec3(1, 0, 0))
wheel.set_max_suspension_travel_cm(15.0)
wheel.set_suspension_stiffness(75.0)
wheel.set_wheels_damping_relaxation(2.0)
wheel.set_wheels_damping_compression(4.0)
wheel.set_friction_slip(15)
wheel.set_roll_influence(0.01)
return wheel

for p in [
(Point3(1, 2, 0), True),
(Point3(-1, 2, 0), True),
(Point3(1, -2, 0), False),
(Point3(-1, -2, 0), False),
]:

Hi Simulan, thank you for your reply!! Here’s where I pass in the coordinates of each wheel.

Fx = 0.097
Fy = -0.068
Fz = 0.2

X = -Fx
Y = Fz
Z = Fy

self.add_wheel(-X, Y, Z, 0.03).reparentTo(self.tank) #forward Left wheel
self.add_wheel(-X, -Y, Z, 0.03).reparentTo(self.tank) #rear left wheel

which calls this function:

def add_wheel(self, x, y, z, dir):

wheelNP = NodePath("wheel")

wheel = self.vehicle.createWheel()

wheel.setNode(wheelNP.node())
wheel.setChassisConnectionPointCs(Point3(x, y, z))
wheel.setFrontWheel(False)

wheel.setWheelDirectionCs(Vec3(0, 0, -1)) #-0.0001)) #sets the wheel forward vector
wheel.setWheelAxleCs(Vec3(dir, 0, 0)) #sets the wheel axel normal vector
wheel.setMaxSuspensionTravelCm(100) #this is not in cm....?

#wheel.setMaxSuspensionForce(0)

wheel.setSuspensionStiffness(100) #This fixed something

wheel.setWheelsDampingRelaxation(2.3)
wheel.setWheelsDampingCompression(4.4)
wheel.setFrictionSlip(200)
wheel.setRollInfluence(0.4)

return wheelNP

As far as I can tell I am doing essentially the same thing as you, however my numbers are much smaller, but I’m using dimensions in meters, the vehicle is just small. Do you have any other thoughts?

I was able to get things to behave by scaling everything up x10, including gravity and speeds. But the wheels were still not showing up in the correct location, but I was able to offset their position.

Still not sure what I was missing, but I’ll revisit it later I guess