Hi,
I've got a may silly question. I've got this:
def GotoXZ(self, target, limit = 2.0):
action = -1
ca = ACTION_WAIT
while self.distance_to(target) > limit:
tx, ty, tz = self.transform_point(target.x, self.y, target.z,
target.parent)
if tz < 0.0:
txz = tx / tz
if txz < -1.0: action = ACTION_TURN_RIGHT
elif txz > 1.0: action = ACTION_TURN_LEFT
elif txz < -0.3: action = ACTION_ADVANCE_RIGHT
elif txz > 0.3: action = ACTION_ADVANCE_LEFT
else: action = ACTION_GO
else:
if tx < 0.0: action = ACTION_TURN_LEFT
else: action = ACTION_TURN_RIGHT
print action
if action == ca: yield None
else: yield Action(action)
### In class burger ###
...
def get_next_action(self):
return GotoXZ(self,self.point).next()
def Move(self):
if self.action:
self.action=self.get_next_action().action
print self.action
if self.action == ACTION_GO:
self.speed.z=-.25
elif self.action == ACTION_TURN_RIGHT:
self.rotation_speed=-2
elif self.action == ACTION_TURN_LEFT:
self.rotation_speed=2
elif self.action == ACTION_ADVANCE_RIGHT:
self.rotation_speed=-2
self.speed.z=-.25
elif self.action == ACTION_ADVANCE_LEFT:
self.rotation_speed=2
self.speed.z=-.25
else:
self.gox=random.randrange(minx,maxx)
self.goz=random.randrange(minz,maxz)
self.point = soya.Point(scene,self.gox,self.y,self.goz)
def begin_round(self):
soya.World.begin_round(self)
self.Move()
def advance_time(self, proportion):
soya.World.advance_time(self, proportion)
self.add_mul_vector(proportion, self.speed)
self.turn_lateral (self.rotation_speed * proportion)
...
a= Burger(scene)
...
When I start this, it does nothing. The soya window inits, but it's black and
I can't do anything. I think it's a problem with GotoXZ and getting the
information from it.
_______________________________________________
Soya-user mailing list
[email protected]
https://mail.gna.org/listinfo/soya-user