WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 03-11-2014, 08:45 AM
Notch Notch is offline
Member
 
Join Date: Jan 2014
Posts: 15
Catching outputs from functions called in vizact.ontimer()

How can I capture the outputs from a function called using the vizact.ontimer() function? I understand that I need to define the name of the function I want to call, and pass any arguments in to the function following that; eg:

Code:
vizact.ontimer(0,myFunction,input)
...But I don't know how to get the outputs of myFunction. How do I do this?
Reply With Quote
  #2  
Old 03-12-2014, 07:19 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,458
Can you explain what you are trying to accomplish with a timer function and the output you're expecting?
Reply With Quote
  #3  
Old 03-19-2014, 04:33 AM
Notch Notch is offline
Member
 
Join Date: Jan 2014
Posts: 15
At every screen refresh, I need to manipulate a quad based on the position of a couple of trackable (from motion capture) rigid bodies. I need to pass some variables back into 'myFunction' that are output from 'myFunction' on each occurrence. These are a few ints and bools.
Reply With Quote
  #4  
Old 03-19-2014, 11:19 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I'd recommend creating a class to update the quad and to store variables from each update. Here is a simple outline of what I am referring to:
Code:
import vizact

class QuadManipulator(object):
	def __init__(self, input):

		# Save input
		self.input = input

		# Initialize variables here
		self.some_int = 0
		self.some_bool = False

		# Call our method every frame
		vizact.ontimer(0, self.myFunction)

	def myFunction(self):

		# Compute some stuff and update quad

		# Update some variables
		self.some_int = 2
		self.some_bool = True

# Create instance of our class
q = QuadManipulator('input')
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:58 AM.


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