WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   vizact classes (https://forum.worldviz.com/showthread.php?t=503)

Vbents 02-06-2006 10:39 PM

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

farshizzo 02-07-2006 10:10 AM

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)

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,
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)


farshizzo 03-02-2006 12:51 PM

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.

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:30 AM.

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