BGE-Hinge Constraint Change Flexibility?

When I use the rigidbody joint - hinge it acts like a spring, is it possible to edit the damping/flexibility to make object1 “stick” to object2?
Maybe this is possible to do with a python script?
Hope you understand my problem… Any solutions is appreciated!

Thanks!

If it’s too floppy and you specify the angle with no motion, then the solution is to increase the physics substeps. This can be done either from the world panel or with the python:

import bge
bge.constraints.setNumTimeSubSteps(5)

I generally find five is enough for any 1-2 joint structures. The highest I’ve done is 15 for a 30-40 joint chain.

If you want more control over a contraint you have to create it yourself:


    id1 = obj1.getPhysicsId()
    id2 = obj2.getPhysicsId()
    
    '''bge.constraints.createConstraint(physics_id_1, physics_id_2,
                             constraint_type,
                             edge_position_x, edge_position_y, edge_position_z,
                             edge_angle_x, edge_angle_y, edge_angle_z)'''

    obj1['joint'] = bge.constraints.createConstraint(id1, id2,
                             bge.constraints.GENERIC_6DOF_CONSTRAINT,
                             0,0,0,0,0,0)
                             
    obj1['joint'].setParam(0, 0.0, 0.0) #No X translation
    obj1['joint'].setParam(1, 0.0, 0.0) #No Y translation
    obj1['joint'].setParam(2, 0.0, 0.0) #No Z translation                     
    obj1['joint'].setParam(3, 0, 0) #No X Rotation
    obj1['joint'].setParam(4, 0, 0) #No Y Rotation
    obj1['joint'].setParam(5, 0.0, 0.0)  #No Z Rotation 

Nothing here that can’t be done from the UI, until:


obj1['joint'].setParam(12, SUSPENSION_LINEAR_STIFFNESS, 0.0001) #Magic    
obj1['joint'].setParam(16, SUSPENSION_ANGULAR_STIFFNESS, 0.0001) #More Magic 

This allows me to set the amount of springyness in a joint. By default this set pretty sensibly, so don’t tweak it unless you want to do something like car suspension, flexible hoses and so on.