WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-03-2009, 10:02 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Here is the forearm added to an example that Farshizzo recently posted for using lookat. It works for other bones, I just had to subtract 90 degrees from the yaw value to make it look right.

Code:
import viz
import vizact
viz.go()

viz.add('tut_ground.wrl')

#Create animating ball
ball = viz.add('white_ball.wrl')
ball.add(vizact.sequence(vizact.goto(-2,1,0),vizact.goto(2,1,0),viz.FOREVER))

#Create male avatar
avatar1 = viz.add('vcc_male.cfg',pos=(-2,0,3),euler=(180,0,0))
avatar1.state(1)
head1 = avatar1.getBone('Bip01 Head')
head1.lock()

#Create female avatar
avatar2 = viz.add('vcc_female.cfg',pos=(2,0,3),euler=(180,0,0))
avatar2.state(1)
head2 = avatar2.getBone('Bip01 Head')
forearm = avatar2.getBone('Bip01 R Forearm')

head2.lock()

def UpdateAvatarHead():
	"""Update avatars to look at ball position"""
	pos = ball.getPosition()
	
	head1.lookat(pos,0,viz.AVATAR_WORLD)
	head2.lookat(pos,0,viz.AVATAR_WORLD)
	
	forearm.lookat(pos,0,viz.AVATAR_WORLD)
	ori = forearm.getEuler(viz.AVATAR_WORLD)
	forearm.setEuler([ori[0] - 90, ori[1], ori[2]], viz.AVATAR_WORLD)
	

vizact.ontimer(0,UpdateAvatarHead)

viz.MainView.move(0,0,-5)
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
Problems with getting head bone rotation right Enlil Vizard 2 02-13-2009 10:24 AM
Awkward neck/shoulder connection when adding custom head to vcc model. vEsotu Vizard 5 10-09-2008 05:07 PM
problems adding a custom morph head to a custom body Greenwu Vizard 1 07-27-2006 10:32 AM
avatar head texture issues rconrey Vizard 3 11-17-2004 04:05 PM
How to simply texture an avatar's head with a jpeg graphic? vr_boyko Vizard 3 10-26-2004 10:44 AM


All times are GMT -7. The time now is 02:27 PM.


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