Creating Subclasses of Vizard Classes
Hey,
I might be in a little over my head here, but is there any convenient way to make a class that inherits all the Thanks ahead of time! -Josh |
Hi,
What you want to do is very easy. Here's a simple example that should get you started: Code:
import viz |
Thanks, farshizzo... that should help a lot.
-Josh |
I want to do a similar sub class, but use an imported object as the node. should I just put
self.node = viz.add("ball.wrl") or viz.VizNode.__init__(self,"ball.wrl") or something else? |
also, can I have an object that inherits from both an event class and a node? that is, i want something that both has a visual representation and controls its own animations. To do so would I call
class ObjectWithEvent(viz.EventClass,viz.VizNode) or would I subclass the node first also, how would I initialize such an object (if it doesn't conflict with itself) |
To subclass from an imported object you would do the same thing as subclassing from an OTF object. I'm posting an example script that shows how to do this. It also shows how to subclass from an EventClass also. One thing to note when subclassing from a VizNode and EventClass is that both classes have a callback function, so you have to explicitly specify which version you want to call when using it. The sample script shows how to do this.
Code:
import viz |
i guess i'm really into sublcassing ;)
anyway, now i want to make a subclass of an Avatar. I want to have the same functionality of the vizard class, but also add my own custom actions. right now i just have a generic class with an avatar as an instance variable, but i have to remake a lot of function wrappers for every action i want to add. is there a way to add behaviors/actions to a vizard-class or sub-classes avatar? that is, i want to have calls like .state(27) or .execute(29) with 27/29 being my own. should i subclass off vizavatar, node3d? does this make sense? |
Hi,
The avatar class is already a subclass of the node class, so you just need to subclass from the avatar. Here is a small sample: Code:
class MyAvatar(viz.VizAvatar): |
if i have a list of xyz rotations (from head tracking file) and i want to make an action that is generic (for any avatar) and repeatable, should I make a vizact object via:
Code:
actionList = [] Code:
avatar = viz.add('avatar.cfg') |
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): Code:
headAction = animatehead('headdata.txt') |
All times are GMT -7. The time now is 09:41 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC