WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 04-06-2009, 12:52 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
If you want to link the avatar to the viewpoint, you could use keyboard navigation like this to move the viewpoint and avatar forward and turn side to side.

Code:
import viz
viz.go()

viz.add('tut_ground.wrl')

avatar = viz.add('vcc_female.cfg')
avatar.state(1)

import viztracker
keyTracker = viztracker.Keyboard6DOF(forward=viz.KEY_UP,backward=viz.KEY_DOWN,turnRight=viz.KEY_RIGHT,turnLeft=viz.KEY_LEFT)

view = viz.MainView
viz.link(keyTracker, view)

link = viz.link(view, avatar)
link.preTrans([0,-1.8,2])

#change the state when avatar stops or starts
pos = avatar.getPosition()
def checkState():
	
	global pos
	if pos == avatar.getPosition():
		avatar.state(1)
	else:
		pos = avatar.getPosition()
		avatar.state(2)
		
vizact.ontimer(.1, checkState)
Reply With Quote
 


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
Walking viewpoints TrashcanPatrol Vizard 5 05-02-2013 10:14 AM
Walking Function Moh200jo Vizard 2 02-24-2009 11:07 AM
How to make avatars to follow terrain while walking? yyang Vizard 1 08-04-2008 03:54 PM
Walking avatars --> collision detection? sjroorda Vizard 3 10-13-2005 05:47 AM


All times are GMT -7. The time now is 07:12 PM.


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