WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 02-06-2006, 10:39 PM
Vbents Vbents is offline
Member
 
Join Date: Sep 2005
Posts: 25
vizact classes

Hi,

I'm trying to update my copy of punch demo to work in 2.53, and I've run into a familiar problem with the fall action class. If you have a working copy of PunchDemo, that would be great, but I would still really like to know how to use Vizard's new action classes.

Is there a tutorial that explains how to use python classes to define new actions? If not, can you at least explain what the _actiondata_ attribute is, and how it is initialized? It would also be very useful to see a generic action class which correctly initializes, updates, and terminates an action.

Finally, how can I see what an avatar's current animation is? This call no longer works:

if avatar.get(viz.CURRENT_ANIMATION) == fall

Thanks for your help,
Ben

Last edited by Vbents; 02-06-2006 at 10:42 PM.
Reply With Quote
  #2  
Old 02-07-2006, 10:10 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The punching demo is available for download at the following link:http://www.worldviz.com/download/index.php?id=19

The actiondata is just a generic container which holds the data describing an action. It must contain an attribute called actionclass which points to an ActionInstance class that implements the action. The fall action in the punching demo is a good example of how to implement your own action class.

To get the current action of a node use:
Code:
node.get(viz.CURRENT_ACTION)
Reply With Quote
  #3  
Old 03-02-2006, 12:23 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Still Confused

I'm still really confused on what the purpose of the FallAction class is. Would it be possible to give a brief synopsis of what it entails. Specifically, I'd like to know what the following lines do. Thanks,
Code:
fall = viz.ActionData()
fall.data = [5,5,5]
fall.actionclass = FallAction
I was also wondering if there was any documentation as to what self._actiondata_.data[0] self._actiondata_.data[1] self._actiondata_.data[2] meant in the following code. Is there any additional information on the details of this actiondata declaration?

Code:
	def begin(self,object):
		
		self.distance = self._actiondata_.data[0]
		self.speed = self._actiondata_.data[1]
		self.anim = self._actiondata_.data[2]
		
		self.amount = 0
		object.state(1)
		object.clear(1,0)
		object.execute(self.anim)
		yaw = object.get(viz.EULER)[0]
		self.vector = [-math.sin(yaw*vizmat.DEG_TO_RAD),0,-math.cos(yaw*vizmat.DEG_TO_RAD)]
		self.pos = object.get(viz.POSITION)

Last edited by betancourtb82; 03-02-2006 at 12:42 PM.
Reply With Quote
  #4  
Old 03-02-2006, 12:51 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

The first code block create an ActionData object. An ActionData object simply holds the relevant information for performing an action. You can put whatever information you want inside of it. The actionclass member is the only attribute of the ActionData object that must be defined. It needs to point to a class that inherits from viz.ActionClass. The _actiondata_ member of the ActionClass is a reference to the ActionData object. So in the code you provided, it is simply retrieving the 3 values from the ActionData object. In that specific example, the 3 values are the distance to fall, the speed to fall, and the animation to play.
Reply With Quote
  #5  
Old 03-03-2006, 12:47 PM
betancourtb82 betancourtb82 is offline
Member
 
Join Date: Jan 2006
Posts: 103
Another Question

I had a question about the Punching Demo Prompt. Everything works out fine when I run it checking off "HMD", "Stereo", and "FullScreen". The problem occurs when I click on Tracker. Should this demo be able to look around as I'm punching? I removed the viz.eyeheight(-0.3) command and that corrects the height of the viewpoint, but once I turn on the tracker, the fist does not work. Any suggestions?
Reply With Quote
  #6  
Old 03-08-2006, 10:09 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
When you select the TRACKER option, the script will attempt to connect to 2 intersense devices and 2 PPT markers. Unless you have these hardware devices connected, it won't work.
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


All times are GMT -7. The time now is 01:25 PM.


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