As usual I’m only here co’s I have a problem.
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[VehicleOb.name + tnc[x]] VehicleID.addWheel(tireOb, (tireOb.position - VehicleOb.position), suspensionAngle[x], tireAxis[x], suspensionHeight, radius, steering[x]) def Update(self): pass #
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.