WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 15 votes, 5.00 average. Display Modes
  #1  
Old 05-23-2005, 11:13 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

If you wanted to create something that is easy to use and reusable then I would suggest creating your own vizact Action. Here is a basic template for creating the action:
Code:
class MyHeadAction(viz.ActionClass):

	def begin(self,object):
		#Get the list of ori data
		self.oridata = self._actiondata_.data
		
		#Get the head bone and lock it
		self.bone = object.getbone('skel_Head')
		self.bone.lock()

	def update(self,elapsed,object):
		#Called every frame to update action
		if self.finished():
			return

		#Update the head rotation
		self.bone.rotate(x,y,z)
		
		#When the action is finished call the following
		self.end(object)
		
def animatehead(filename):
	action = viz.ActionData()
	#Read orientation data from file and add it to action data
	action.data.append([x,y,z])
	action.actionclass = MyHeadAction
	return action
Now you would use the following code to perform your custom action:
Code:
headAction = animatehead('headdata.txt')

avatar.add(headAction)
Let me know if you need anymore help with this
Reply With Quote
Reply


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


All times are GMT -7. The time now is 08:37 PM.


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