Oh, thanks Jeff!
But when the avatar stopped for awhile, and then she wants to continue with same direction the code takes her to the other direction (z-axis).
I have tried to increment x-axis but wasn’t practically.
As well as I tried to make the mainview to follow the avatar, when this has been done, the key function does not work probably
HTML Code:
import viz
import viztask
viz.go()
mainview=viz.clearcolor(viz.SKYBLUE)
avatar = viz.add('vcc_female.cfg')
avatar.setPosition(0,0,9)
pos = avatar.getPosition()
#view = viz.MainView
#link = viz.link(avatar, view)
#link.preTrans([0,-.5,-5])
ss=1
def myKeyboard(key):
ss=1
gg=5
global walk_Forward
pos = avatar.getPosition()
if key == viz.KEY_UP:
ss=ss+5
walk_Forward = vizact.walkTo([pos[0], pos[1],pos[2]+ss])
avatar.addAction(walk_Forward,pool=1)
if key==viz.KEY_LEFT:
gg=gg + 10
rotate=vizact.spin(0,1,0,gg,1)
avatar.addAction(rotate, pool = 1)
if key == viz.KEY_DOWN:
ss=ss+5
walk_Forward = vizact.walkTo([pos[0], pos[1], pos[2] - ss])
avatar.addAction(walk_Forward)
viz.callback(viz.KEYBOARD_EVENT,myKeyboard)