PDA

View Full Version : Problem making avatar climb stairs


SUJITH_KJ
12-16-2014, 06:14 PM
Hi all,

I am trying to make an avatar climb stairs. I am trying to move the avatar using tracking data obtained from kinect and FAAST.. but i am not able to make the avatar climb stairs in my environment.. I would also like to know if we could make the avatar climb stairs using the vizact.walkTo command. Thanks in advance for any help..
Thank you
Regards
Sujith

mape2k
12-17-2014, 02:11 AM
Hi,

I think you should look into the viz.MainView.stepsize(x) command. It sets how much distance (in meters) the viewpoint is allowed to climb up when it encounters an object (like a stair).

e.g. viz.MainView.stepsize(.3) -> the avatar will climb over any object that is lower or equal to 30cm. I am pretty sure this would also work for an avatar!

Jeff
12-17-2014, 12:23 PM
Is the avatar walking up virtual stairs going to be in sync with the user's movements walking forward?

SUJITH_KJ
12-17-2014, 06:46 PM
Yes.. Avatar and user are in sync...

Jeff
12-19-2014, 01:14 PM
You can do an intersection test to find out the height of the ground below the avatar and then adjust the avatar's height:

'''
Use up/down arrows to move avatar
'''

import viz
import vizact
import vizmat
import vizinfo

viz.setMultiSample(4)
viz.fov(60)
viz.go()

vizinfo.InfoPanel(align=viz.ALIGN_RIGHT_TOP)

viz.clearcolor(viz.SLATE)
viz.addChild('ground.osgb')
viz.move([0,0,-2])

quad = viz.addTexQuad(pos=[0,0,4.5],euler=[0,65,0],scale=[2,10,1],color=viz.RED)
quad2 = viz.addTexQuad(pos=[0,0,13.55],euler=[180,65,0],scale=[2,10,1],color=viz.RED)

avatar = viz.addAvatar('vcc_male2.cfg')
avatar.disable(viz.INTERSECTION)
avatar.state(2)

vizact.whilekeydown(viz.KEY_UP,avatar.setPosition,[0,0,0.03],viz.REL_LOCAL)
vizact.whilekeydown(viz.KEY_DOWN,avatar.setPositio n,[0,0,-0.03],viz.REL_LOCAL)

def adjustHeight():
x,y,z = avatar.getPosition()
info = viz.intersect([x,y+0.5,z],[x,y-0.5,z])
groundHeight = info.point[1]
avatar.setPosition([x,groundHeight,z])

vizact.onupdate(0,adjustHeight)

view = viz.addView()
view.setPosition([-20,5,9])
view.setEuler([90,15,0])
window = viz.addWindow(view=view)
window.setSize([.4,.4])
window.setPosition([0,1])

SUJITH_KJ
12-22-2014, 12:43 AM
Thank you Jeff, that was useful.. Can v do it with vizact.walkTo command also?

Jeff
12-22-2014, 01:46 PM
Yes, you can give a model name as the Y position of the walkTo command. The walkTo will adjust the height of the avatar to match the height of the model:

import viz
import vizact
import vizmat

viz.setMultiSample(4)
viz.fov(60)
viz.go()

viz.clearcolor(viz.SLATE)
viz.addChild('ground.osgb')
viz.move([0,0,-2])

quad = viz.addTexQuad(pos=[0,0,4.5],euler=[0,65,0],scale=[2,10,1],color=viz.RED)
quad2 = viz.addTexQuad(pos=[0,0,13.50],euler=[180,65,0],scale=[2,10,1],color=viz.RED)

avatar = viz.addAvatar('vcc_male2.cfg')
avatar.disable(viz.INTERSECTION)
avatar.state(2)

walk1 = vizact.walkTo([0,0,4.5],walkSpeed=2)
walk2 = vizact.walkTo([0,quad,9],walkSpeed=2)
walk3 = vizact.walkTo([0,quad2,13.55],walkSpeed=2)

walk = vizact.sequence([walk1,walk2,walk3])
avatar.runAction(walk)

view = viz.addView()
view.setPosition([-20,5,9])
view.setEuler([90,15,0])
window = viz.addWindow(view=view)
window.setSize([.4,.4])
window.setPosition([0,1])

SUJITH_KJ
01-19-2015, 05:57 PM
Thank you Jeff for the previous programs.. Can the avatar also be made to climb stairs which is vertical? . The above programs work well for stairs which is inclined.. but i am not sure how to do it for stairs which is vertical

Jeff
01-20-2015, 05:38 AM
I'm not sure what you want to do. If the avatar should go only up and down you could update just it's Y position.