Accessing Rigid Body Constraints not created dynamically.

Hi,
Any suggestions for how to get access to a rigid body constraint that was not created at run-time?

For example, before starting the game engine, if rbObjectA and rbObjectB are rigidbody objects, we can create

joint6DOF = constraints.new(‘RIGID_BODY_JOINT’)
joint6DOF.pivot_type = ‘GENERIC_6_DOF’

but let’s say I need to update its motor every tick, how do I find the equivalent object to joint6DOF in a runtime script?

Where if I created it dynamically in bge code with something like

rtJoint = PhysicsConstraints.createConstraint( objectA_ID, objectB_ID, constraint_type, 0.0, 0.0, 0.0, offset[0], offset[1], offset[2], flag)

#constraint_type = 12 creates a 6DOF

I know I that every tick I can update the motor with calls like

rtJoint.setParam(11, fTargetVelocity, fMaxForce) # 11 points to rotations about Z

(Apologies for the hardcoded numbers like 12 and 11, but the python wrapper for the runtime constraints seems not to be complete.)

Cheers,

Colm

http://www.tutorialsforblender3d.com/GameModule/ClassKX_PyConstraintBinding_1f.html
Don’t forget to “import GameLogic” to get the old examples to work.

Thanks HG1. The page you reference shows how to create and drive various joints when the game engine is running, but I still can’t see how I would find rigidbody constraints that were already there. In the example scenes referenced, rigid body constraints are created dynamically once the engine is running. Through the logic blocks, it applies forces directly to one of the objects using an Actuator rather than the rigid body constraint. So I’m still stuck. :frowning: I’m looking at taking the approach that I think is used in BRIK, to autocreate everything dynamically which is really inefficient, but might be the only way.

I believe that the only way to access to constraints is with the bpy module that not run in BGE.

I was coming to that conclusion too. My feeling is that it wouldn’t be much work to tidy the PhysicsConstraints wrapper of Bullet to make all the usable data accessible in runtime. Sadly my C++ is very rusty. For now I think I’ll look into creating the constraints dynamically. Thanks, Colm