WorldViz User Forum

WorldViz User Forum (
-   Vizard (
-   -   vizact classes (

Vbents 02-06-2006 10:39 PM

vizact classes

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,

farshizzo 02-07-2006 10:10 AM


The punching demo is available for download at the following link:

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:


betancourtb82 03-02-2006 12:23 PM

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,

fall = viz.ActionData() = [5,5,5]
fall.actionclass = FallAction

I was also wondering if there was any documentation as to what[0][1][2] meant in the following code. Is there any additional information on the details of this actiondata declaration?


        def begin(self,object):
                self.distance =[0]
                self.speed =[1]
                self.anim =[2]
                self.amount = 0
                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)

farshizzo 03-02-2006 12:51 PM


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.

betancourtb82 03-03-2006 12:47 PM

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?

farshizzo 03-08-2006 10:09 AM

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.

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

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