Custom Vehicle Class addWheel code problem.

Hi all,

As usual I’m only here co’s I have a problem. :wink:

I’m kinda hoping that it’s because its late for me now and I’m missing something simple but I’m not so sure.

Here’s my attempt at a customish Vehicle class.
(Code has been pilfered from various sources all of which will be mentioned in any future release file.)

class Vehicle():
    def __init__(self, VehicleOb):
        #VehicleID = bge.constraints.getVehicleConstraint(bge.constraints.createConstraint(VehicleOb.getPhysicsId(), 0, 11).getConstraintId())
        vehPhysID = VehicleOb.getPhysicsId()
        vehConstraint = bge.constraints.createConstraint(vehPhysID, 0, 11)
        constraintID = vehConstraint.getConstraintId()
        VehicleID = bge.constraints.getVehicleConstraint(constraintID)

        # Create `vehicleId` as a property on the Vehicle Object.
        VehicleOb["vehicleID"] = VehicleID

        tnc = ["FD", "FP", "RD", "RP"] # Tire Naming Convention        
        suspensionAngle = [0.0, 0.0, -1.0]
        tireAxis = [-1.0, 0.0, 0.0]
        suspensionHeight = VehicleOb["Suspension"]
        radius = VehicleOb["Radius"]
        steering = [True, True, False, False]

        for x in range(4):
            tireOb = sl0[ + tnc[x]]
                                (tireOb.position - VehicleOb.position),

    def Update(self):


When the script runs it creates an…
Attribute error: Not a sequence type, expected a sequence of numbers size 3.
… on the steering[x] line of the addWheel method.

If I try a bodge by replacing steering[x] with [1,1,1] it expects an integer?

You`ll have to pardon the pun but I’m tired now so I may have missed vital info needed for assistance.
(Is anyone going to get the tenuous link there I wonder?)

Any help is greatly appreciated.


I suggest to check the API what parameters are expected.

Thanks gentlemen, it was a school boy error in the end. I shouldn’t have had the [x] after the suspensionAngle and tireAxis in the addWheel method at the end of the script.

In essence I was giving the method an array position rather than a full vector3 list.
(Or something like that, not sure what the correct terminology would be.)

I’m looking in to other stuff atm BluePrint but I’ll be checking your 6dof joints out in the near future hopefully.