WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-21-2009, 03:48 AM
5ky1ine 5ky1ine is offline
Member
 
Join Date: Mar 2009
Posts: 10
linking view to avatar

is ther any way of linking the view to an avatar and walk around the environment using the keyboard like in a game?

any help will be really appreciated..
Reply With Quote
  #2  
Old 04-21-2009, 06:41 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
try the following code to link the avatar with the mainview
HTML Code:
mainview=viz.clearcolor(viz.SKYBLUE)
avatar = viz.add('vcc_female.cfg')
avatar.setPosition(0,0,9)
view = viz.MainView
link = viz.link(avatar, view)
link.preTrans([0,-0.5,-5])
Reply With Quote
  #3  
Old 04-21-2009, 07:11 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
I correct this what you are looking for.
HTML Code:
import viz
import vizcam
viz.go()
viz.add('tut_ground.wrl')
avatar = viz.add('vcc_female.cfg')
avatar.state(2)
handcontrol = vizcam.KeyboardCamera(forward=viz.KEY_UP,backward=viz.KEY_DOWN,turnRight=viz.KEY_RIGHT,turnLeft=viz.KEY_LEFT)
viz.cam.setHandler(handcontrol)
view = viz.MainView
link = viz.link(view, avatar)
link.preTrans([0,-1.5,5])
pos = avatar.getPosition()
Reply With Quote
  #4  
Old 04-21-2009, 08:04 AM
5ky1ine 5ky1ine is offline
Member
 
Join Date: Mar 2009
Posts: 10
thanks for the reply,

the code works fine apart from the avatar is in the walking state even when you are not pressing anything. is there anyway to make the avatar stand still when no key is being pressed?
Reply With Quote
  #5  
Old 04-21-2009, 09:08 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
yes just define a function to check the avatar state

Last edited by Moh200jo; 04-21-2009 at 09:11 AM.
Reply With Quote
  #6  
Old 04-21-2009, 09:17 AM
5ky1ine 5ky1ine is offline
Member
 
Join Date: Mar 2009
Posts: 10
can you tell me how that is done please

thanks
Reply With Quote
  #7  
Old 04-21-2009, 09:39 AM
Moh200jo Moh200jo is offline
Member
 
Join Date: Feb 2009
Posts: 99
I correct something like this:
HTML Code:
avatar_position = avatar.getPosition()
def avatarstate():
	global avatar_position
	if avatar_position == avatar.getPosition():
		avatar.state(1)
	else:
		avatar_position= avatar.getPosition()
		avatar.state(2)
		
vizact.ontimer(.05, avatarstate)
I hope this will be helpful
Reply With Quote
  #8  
Old 04-21-2009, 11:03 AM
5ky1ine 5ky1ine is offline
Member
 
Join Date: Mar 2009
Posts: 10
Thanks that worked, but only one thing left, the avatar dosent have collision, it walks through the walls and other objects. any suggestions
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
View nlfrnassimi Vizard 4 03-12-2009 05:25 AM
Linking problems with Live Character Frank Verberne Vizard 5 06-04-2008 11:42 AM
Looking through the eyes of an avatar Frank Verberne Vizard 2 04-01-2008 05:52 AM
How to make avatar's eyes to blink when speaking michelcm3 Vizard 12 01-15-2008 08:48 AM
Linking avatar 'bones' to a position tracker. zachhendershot Vizard 3 11-19-2003 09:26 PM


All times are GMT -7. The time now is 02:41 AM.


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