Trying to create an airbag version of Pressure Ball

Hi again,
Thank you for your previous reply, it works perfectly. I am trying to figure out one thing and I really need your help. While I am setting the velocity in the forward direction, I would like the object’s rotation to remain locked. Additionally, I want to restrict its movement so that it can only translate along a single axis (the y-axis).

Is there a way to constrain the object so that its rotation is locked and its translation is limited to only one axis?
I have also added a visual representation what I want to do.

current code to enforce rotation:

def enforce_rotation():

    while running:

        vehicle1.sensors.poll()

        pos = vehicle1.state\['pos'\]

        vehicle1.teleport(pos=pos, rot_quat=(0, 0, 0, 1), reset=False)

        time.sleep(0.05)

t = threading.Thread(target=enforce_rotation, daemon=True)

t.start()

Hello @SuvrangshuBarua,

BeamNGpy has no API to lock rotation or restrict motion to one axis. set_velocity pushes along the vehicle’s forward direction only — it does not fix orientation.

Important — axis convention

In BeamNG’s documented coordinate system (Nodes):

  • X = left / right (lateral)
  • Y = forward / back (longitudinal — this is the vehicle forward axis in JBeam)
  • Z = up / down

So set_velocity moves the object along the vehicle’s local Y (forward), not X. If you want motion of your airbag along your “forward” in the diagram; you may rotate the airbag so its forward axis points along ±X:

If you must lock rotation

For a strict test rig (fixed orientation + motion on one axis only), you could teleport the object each simulation step:

 vehicle.teleport((x, y0, z0), rot_quat=fixed_rot_quat, reset=False)

Keep y0 and z0 constant; only x changes.

Please let me know if you want help further help with your work!

Kind regards,

Abdulrahman Saeed
Research Software Engineer
BeamNG.tech Support Team