need helps on python scripts

I need some advice on python

I have one boom which is driven by a cylinder. I want to limit the rotation of this boom according to the cylinder strike. Such as that boom stops when cylinder strike meet its end. Actually, i have already set the limits on constraints in Rigid body joint, but not working at all. Thats why i choose to set the limitation via python.

Here is the code:

# theta1 is the first rotation angle, i set the limit e.g. to 10)
       if own['theta1'] < 10 :   
#If it is in the range, i will apply the force on the boom)
            Force = [0,0,20000]  
            own['position'] = own.worldPosition
            print('Theta1 is ',own['theta1'])
#if it is out of range, just stop at the critical angle,that is 10
        elif own['theta1'] > 10:

However, it is not enough arguments on the ‘out of range’ part. I tried to limit the worldPosition of object, but the boom was always shaking or moving, i just want it to stop! I will appreciate if anybody has any idea

Thanks a lot!


  • Parent the objects together
  • set up IPO/F-Curves for each object to perform the animation
  • activate an IPO/F-Curve actuator at the root bone, with switch “Child enabled”


Platform.blend (429 KB)

if use armature , the connstraint bone work in bge