#1
|
|||
|
|||
Problem making avatar climb stairs
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 |
#2
|
|||
|
|||
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! Last edited by mape2k; 12-17-2014 at 02:14 AM. |
#3
|
|||
|
|||
Is the avatar walking up virtual stairs going to be in sync with the user's movements walking forward?
|
#4
|
|||
|
|||
Yes.. Avatar and user are in sync...
|
#5
|
|||
|
|||
You can do an intersection test to find out the height of the ground below the avatar and then adjust the avatar's height:
Code:
''' 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.setPosition,[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]) |
#6
|
|||
|
|||
Thank you Jeff, that was useful.. Can v do it with vizact.walkTo command also?
|
#7
|
|||
|
|||
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:
Code:
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]) |
#8
|
|||
|
|||
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
|
#9
|
|||
|
|||
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.
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
problem with avatar climp a ramp | befl0 | Vizard | 14 | 07-30-2014 02:28 PM |
.osg biped avatar problem | alvinadi | Vizard | 3 | 12-20-2011 10:29 AM |
Avatar speaking problem | Uttama_vizard | Vizard | 4 | 03-23-2009 11:29 AM |
Problem with letting an avatar face towards another avatar | ghazanfar | Vizard | 2 | 03-21-2007 02:30 AM |
making a talking and imitating avatar | marc van gaal | Vizard | 9 | 10-20-2006 04:28 AM |