WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 07-25-2006, 02:29 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Quote:
I just tried the script for R2.5 as shown below which was given by Farshid, but it doesn't work with R3. Could anyone tell what's wrong with it, please?
The spin actions work fine on viewpoints. The problem is that the STOP_EVENT has been modified in 3.0. Replace your onstop function with the following:
Code:
def onstop(e):
	if e.action == viz.MOVE:
		#Viewpoint is done moving, translate it to the final value just to be sure
		view.translate(final)
		view.animating = 0
	elif e.action == viz.SPIN:
		#Viewpoint is done spinning, rotate it to the final value just to be sure
		view.rotate(final,viz.BODY_ORI)
		view.animating = 0
Quote:
You may probably find that you have a similar error ("TypeError: spaceturn() takes exactly 2 argumemts (1 given)") when you use SpaceBall. I'd appreciate it if you could fix it. Thanks!
The spaceball callbacks have also been modified. Here is an example script for 3.0 that uses the spaceball:
Code:
import viz
import vizspace
viz.go()

viz.add('gallery.ive')

viz.mouse(viz.OFF)

def spacemove(e):
	viz.MainView.move(viz.Vector(e.pos)*e.elapsed)
	
def spacerot(e):
	viz.MainView.rotate(1,0,0,e.ori[0]*e.elapsed,viz.HEAD_ORI,viz.RELATIVE_LOCAL)
	viz.MainView.rotate(0,1,0,e.ori[1]*e.elapsed,viz.HEAD_ORI,viz.RELATIVE_LOCAL)
	viz.MainView.rotate(0,0,1,e.ori[2]*e.elapsed,viz.HEAD_ORI,viz.RELATIVE_LOCAL)

def spacebuttondown(button):
	print 'Button',button,'pressed'
	
def spacebuttonup(button):
	print 'Button',button,'released'
	
viz.callback(vizspace.TRANSLATE_EVENT,spacemove)
viz.callback(vizspace.ROTATE_EVENT,spacerot)
viz.callback(vizspace.BUTTONDOWN_EVENT,spacebuttondown)
viz.callback(vizspace.BUTTONUP_EVENT,spacebuttonup)
Reply With Quote
 


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 05:16 AM.


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