motion actuators & python

ok, im currently working on a pathfinding-AI with python, the object with the AI will follow a path created dynamically by an empty running to the target and placing other empties ( i know, it’ complicated, but i want the AI to dynamically find the shortest way.

however, i’m stuck with the simple motion actuator i think. i use it to move the pathmaking empty forward and to track it to the target ( no, i don’t use the trackto-actuator, later on i need to stop the turning in case there was a wall in the way, so that the path goes around the corner and not through it)
it seems that the motion actuator stays active although i switched it off again, so the empty is turning wildly around
no clue what’s going on there, maybe you have?

One way is to use your script to set the corresponding motion values, and then set them to zero when you want the empty to stop:

cont = GameLogic.getCurrentController()
move = cont.getActuator('move')
if moveEmpty:
    move.setLinearVelocity( 5, 0, 0, 1)
elif stopEmpty:
    move.setLinearVelocity( 0, 0, 0, 1)

I’ve had that problem before and this is one way I solved it.

To answer your question more directly: I have no idea why it does that. :stuck_out_tongue:

Pretty neat idea, by the way. Hope it works!

hehe, okay, i just figured out that this kind of pathfinding would take several frames to work because the empty has to be moved… so that’s no good way