I want to create some constraints in BGE with phyton (between a soft body and a dynamic object) and then remove them after a while. I tried this code to save constraint's id:

import bge

p = bge.logic.getCurrentScene().objects["Plane"].getPhysicsId()

o = bge.logic.getCurrentController().owner

o["c"] = bge.constraints.createConstraint(o.getPhysicsId(), p, 1, 0.0, 0.0, 0.0).getConstraintId()

the constraint created and all of parameters seems to be correct but getConstraintId always returns zero and I can't understand why?

  • $\begingroup$ also here mentioned that it will returns zero if there isn't a constraint ID but i can't figure out why there shouldn't be a constraint ID? $\endgroup$
    – SRH
    Dec 8, 2015 at 6:29
  • $\begingroup$ the code also works well when I change the soft body (plane) to a rigid body. only when it is soft, there isn't a constraint id! $\endgroup$
    – SRH
    Dec 8, 2015 at 7:15

1 Answer 1


As an experience I understand that Blender's Game Engine can't create constraints on Soft Bodies dynamically by bge codes. Actually it creates the constraints but you don't have any access to them.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .