Wallblade

hi
im new at blender and blenderartists.org ;D

trying to make a wallblade, which flips out of the wall if something is near to it
and then flips back

so i tried it normally: sensor -> controller -> actuator
so its flippin just the one direction, no flipback

also tried it with python but no success

cont=GameLogic.getCurrentController()
own = cont.getOwner()
sens = cont.getSensor("sensor")
move = cont.getActuator("move")

rot=move.getDRot()[1]

if sens.isPositive()==True:
           own.go = 1
elif sens.isPositive()==False:
           own.go = 0

if own.go == 1:
           move.setDRot(0.0, 1.0, 0.0, 1)
           GameLogic.addActiveActuator(move,1)

           move.setDRot(0.0, -1.0, 0.0, 1)
           GameLogic.addActiveActuator(move,1)
else:
           move.setDRot(0.0, 0.0, 0.0, 1)
           GameLogic.addActiveActuator(move,0)

im sure u can help me ;D

your mistakenly thinking that the script runs in real time.
if you add an actuator you must wait till the next time the script executes. eg:


# Note: You'll need to add a prop called state to the owner object
if own.go == 1:
    if own.state == 0:
        move.setDRot(0.0, 1.0, 0.0, 1)
        GameLogic.addActiveActuator (move, 1)
        own.state = 1
    else:
        move.setDRot(0.0, -1.0, 0.0, 1)
        GameLogic.addActiveActuator (move, 1)
        own.state = 0
else:
    move.setDRot(0.0, 0.0, 0.0, 1)
    GameLogic.addActiveActuator(move,0)


Replace the “if go” block with this code and it should work.

Try setting it up with an IPO. The “Flipper” playback option does this automatically.

Yah, if you want me to make you an example, tell me…

yah first of all thank you very much
the code of Zeglr Ecklefish looks well but isnt working
and i dont know how to handle with ipo flipper
would be very great if Turin you could make me an example