b3dAddVehicleWheel

Adds a wheel to a vehicle with position, size, and suspension properties. Takes vehicleHandle (vehicle from b3dCreateVehicle), posX/posY/posZ (wheel position in local entity coordinates), radius (wheel radius in units), width (wheel width in units), suspensionMinLength/suspensionMaxLength (suspension travel limits), suspensionFrequency (spring frequency in Hz), suspensionDamping (damping ratio 0-1). Returns wheel index (0-based integer for use with wheel-specific functions).

3D Graphics

Parameters & Returns

Parameters

vehicleHandle Int
posX Double
posY Double
posZ Double
radius Double
width Double
suspensionMinLength Double
suspensionMaxLength Double
suspensionFrequency Double
suspensionDamping Double

Returns

Int

Quick Summary

Adds a wheel to a vehicle with position, size, and suspension properties. Takes vehicleHandle (vehicle from b3dCreateVehicle), posX/posY/posZ (wheel position in local entity coordinates), radius (wheel radius in units), width (wheel width in units), suspensionMinLength/suspensionMaxLength (suspension travel limits), suspensionFrequency (spring frequency in Hz), suspensionDamping (damping ratio 0-1). Returns wheel index (0-based integer for use with wheel-specific functions).

Technical Exegesis...

Adds a wheel to a vehicle with position, size, and suspension properties.

Example

Example.bam
; Create vehicle and add 4 wheels
vehicle = b3dCreateVehicle(carMesh, 1500.0, 0.3, 0.5, 2.0, 0.6, 0.0)

; Add front-left wheel (left side, front position)
wheelFL = b3dAddVehicleWheel(vehicle, -0.9, 0.0, 1.5, 0.4, 0.3, 0.3, 0.5, 2.0, 0.6)

; Add front-right wheel (right side, front position)
wheelFR = b3dAddVehicleWheel(vehicle, 0.9, 0.0, 1.5, 0.4, 0.3, 0.3, 0.5, 2.0, 0.6)

; Add rear-left wheel (left side, rear position)
wheelRL = b3dAddVehicleWheel(vehicle, -0.9, 0.0, -1.5, 0.4, 0.3, 0.3, 0.5, 2.0, 0.6)

; Add rear-right wheel (right side, rear position)
wheelRR = b3dAddVehicleWheel(vehicle, 0.9, 0.0, -1.5, 0.4, 0.3, 0.3, 0.5, 2.0, 0.6)

; Configure front wheels for steering
b3dSetVehicleWheelSteering(vehicle, wheelFL, 35.0)
b3dSetVehicleWheelSteering(vehicle, wheelFR, 35.0)

; Example: Monster truck with large wheels and custom suspension
monsterTruck = b3dCreateVehicle(truckMesh, 3000.0, 0.5, 1.0, 1.5, 0.7, 0.0)

; Large radius (0.6) for high clearance, long suspension travel (0.5-1.0)
b3dAddVehicleWheel(monsterTruck, -1.2, 0.0, 2.0, 0.6, 0.4, 0.5, 1.0, 1.5, 0.7)
b3dAddVehicleWheel(monsterTruck, 1.2, 0.0, 2.0, 0.6, 0.4, 0.5, 1.0, 1.5, 0.7)
b3dAddVehicleWheel(monsterTruck, -1.2, 0.0, -2.0, 0.6, 0.4, 0.5, 1.0, 1.5, 0.7)
b3dAddVehicleWheel(monsterTruck, 1.2, 0.0, -2.0, 0.6, 0.4, 0.5, 1.0, 1.5, 0.7)