Destructible Wall in BGE, Python, need help

Hello everyone,
I try to make a destructible wall in the BGE
I have this file (script) tester1.blend (577 KB) that I find on the forum
that activates the dynamics of all the objects in an area defined by the impact of a sphere,
but the Objects become static again after a certain time …
I would like them to remain dynamic and add a ray sensor?
Which makes dynamic all objects above the object touched by the sphere
so that when the bottom of the wall is broken,everything falls
i made a try with a ray sensor and the “scripts.py”
but I just started with python and my changes have absolutely no effect…

I hope that someone can help ;):smiley:

Edit :

I had not seen your replies, i have started a new thread in python support.
There are quite a few things that have changed in my script, but I still need help on one point

your script has an message sensor on it and the time the message sensor is True is to short for testing if the distance < radius continuously

so test this:


import bge

def bullet(cont):
    own = cont.owner
    
    collision = cont.sensors["Collision"]
    message = cont.actuators["Action"]
    
    radius = own.get('radius', 3)
    
    if collision.positive and not "r" in own:
        bge.logic.bullet = (collision.hitObject, radius)
        cont.activate(message)
        own["r"] = 1
        
        
def brick(cont):
    own = cont.owner
    #own.suspendDynamics()
    message = cont.sensors["Message"]
    
    if message.positive:
        hitObject, radius = bge.logic.bullet
        distance = own.getDistanceTo(hitObject)
        #print(dir(own))
        
    if distance &lt; radius:
        own.restoreDynamics()
    else:
        own.suspendDynamics()


Your code is the same as in the file :confused:

It sounds like you want to change the physics deactivation time in the world settings.

Yes, but it does not seem to have any effect, when I change it …
some “bricks” get stuck and turn off instantly.

no not really take a look at the tabs/spaces in the last 4 lines
have you try it?

    own.restoreDynamics()    else:         own.suspendDynamics()

watch out with this on static objects, it increases its physics mesh.

Yes i had try.
I had not seen your replies, i have started a new thread in python support.
There are quite a few things that have changed in my script, but I still need help on one point

Check “No Sleeping” in the physics panel. You’ll have to do your own cleanup to make sure physics doesn’t slow down the game.

Check my last Post ^^

Posts in other thread
There’s also http://blender.stackexchange.com/ if things here are quiet. As far as I know the bge people don’t really frequent the python support section.