WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-16-2014, 06:14 PM
SUJITH_KJ SUJITH_KJ is offline
Member
 
Join Date: Mar 2014
Posts: 7
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
Reply With Quote
  #2  
Old 12-17-2014, 02:11 AM
mape2k mape2k is offline
Member
 
Join Date: Mar 2013
Posts: 60
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.
Reply With Quote
  #3  
Old 12-17-2014, 12:23 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,414
Is the avatar walking up virtual stairs going to be in sync with the user's movements walking forward?
Reply With Quote
  #4  
Old 12-17-2014, 06:46 PM
SUJITH_KJ SUJITH_KJ is offline
Member
 
Join Date: Mar 2014
Posts: 7
Yes.. Avatar and user are in sync...
Reply With Quote
  #5  
Old 12-19-2014, 01:14 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,414
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])
Reply With Quote
  #6  
Old 12-22-2014, 12:43 AM
SUJITH_KJ SUJITH_KJ is offline
Member
 
Join Date: Mar 2014
Posts: 7
Thank you Jeff, that was useful.. Can v do it with vizact.walkTo command also?
Reply With Quote
  #7  
Old 12-22-2014, 01:46 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,414
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])
Reply With Quote
  #8  
Old 01-19-2015, 05:57 PM
SUJITH_KJ SUJITH_KJ is offline
Member
 
Join Date: Mar 2014
Posts: 7
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
Reply With Quote
  #9  
Old 01-20-2015, 05:38 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,414
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -7. The time now is 01:21 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC