Vehicle Constraint: getWheelOrientationQuaternion

getWheelOrientationQuaternion(wheel)
  • Returns the world wheel orientation matrix.

Return Type:

  • 3x3 orientation matrix.

    wheel:
    • Type:  integer
    • 0 = first wheel added
    • 1 = second wheel added
    • 2 = third wheel added
    • 3 = fourth wheel added
    3x3 orientation matrix example:
    • [ [ 1.0, 0.0, 0.0 ], [ 0.0, 1.0, 0.0 ], [ 0.0, 0.0 ,1.0 ] ]
    • First group of 3 is the x-axis vector.
    • Second group of 3 is the y-axis vector.
       
    • Third group of 3 is the z-axis vector
    Sample Code

    ################ get the wheel orientation matrix

    #import bge
    import bge

    # get current scene
    scene = bge.logic.getCurrentScene()

    # get object list
    objList = scene.objects

    # get vehicle object named car
    objCar = objList["Car"]
        
    # Retrieve constraint ID you saved as a property when you created the vehicle constraint
    constraint_ID = objCar["constraint_ID"]

    # get the vehicle
    vehicle = bge.constraints.getVehicleConstraint(constraint_ID)
     
    # first tire added
    wheel = 0

    get the wheel orientation matrix
    wheel_orientation = vehicle.getWheelOrientationQuaternion(wheel)