Hi All,
First of all, please forgive my english… -__-
So, I’m trying to code a sample of a crowd simulation.
I want my agents follow one leader. Thats works in the scene but the problem start in the BGE.
I explain you with some screenshots :
Here it is the logic view of my leader.

Then you see there is an Always sensor where i run a script “moveAgents”
In this scripts I do some things but the most important (and where is the problem) is that I change the offset_location of each agent.
#Move all agents
def move_all_agents():
'''
Function :
__init__()
Summary :
Arguments :
'''
# bpy.ops.object.select_name(name=own.name)
# cube = bpy.context.selected_objects[0]
GetAgents()
for a in agents:
velocity = [0,0,0]
position = [0,0,0]
v1 = rule1(a)
v2 = rule2(a)
v3 = [0, 0, 0] #rule3(a)
v4 = [0, 0, 0] #v4 = self.bound_position(a)
v5 = followLeader(a, GetLeader())
velocity[0] = v1[0] + v2[0] + v3[0] + v4[0] + v5[0]
velocity[1] = v1[1] + v2[1] + v3[1] + v4[1] + v5[1]
velocity[2] = 0 #a.getVelZ() + v1[2] + v2[2] + v3[2] + v4[2] + v5[2]
a.location[0] = a.location[0] + velocity[0]
a.location[1] = a.location[1] + velocity[1]
a.location[2] = a.location[2] + velocity[2]
move = a.game.actuators["move"]
<b>move.offset_location.x = velocity[0]
move.offset_location.y = velocity[1]
move.offset_location.z = velocity[2]</b>
#end for
#end move_all_agents
Here I show you the logic view of an agent :

So finally, the offset_location (of each agents) is changed first time I run BGE (on press “P”) but their are not refresh, only if i stop BGE and run another time.
I hope you will understand and I thank you for the time you will spend on it.
triguN.