WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-27-2008, 11:59 AM
eirc eirc is offline
Member
 
Join Date: Jan 2008
Posts: 2
Hotspots and Video

Hello,

I don't know if it's a bug but just using viz.addVideo in a world screws up the hotspots. The hotspot code below is a working mix from two other posts and I added the two commented blocks. Uncomment each one and see for yourself.

Code:
import viz
viz.go()

viz.add('tut_ground.wrl')

#Declare Radius of hotspot
RADIUS = 1

#Declare position of hotspot
HOTSPOT_X = 0
HOTSPOT_Z = 3

class HotspotClass(viz.EventClass):
	def __init__(self,enter,leave):
		viz.EventClass.__init__(self)
		
		self.enter = enter
		self.leave = leave
		
		#Create a hotspot that will be triggered when we enter the circle
		viz.starthotspot(self.enter,viz.CIRCLE_HOTSPOT_IN,HOTSPOT_X,HOTSPOT_Z,RADIUS)
		
		self.callback(viz.HOTSPOT_EVENT,self.onhotspot)
		
	def onhotspot(self,id,x,y,z):
		if id == self.enter:
			print 'Entered hotspot',self.enter
			#Create a hotspot that will be triggered when we leave the circle
			viz.starthotspot(self.leave,viz.CIRCLE_HOTSPOT_OUT,HOTSPOT_X,HOTSPOT_Z,RADIUS)
		elif id == self.leave:
			print 'Leaving hotspot',self.leave
			#Create a hotspot that will be triggered when we enter the circle
			viz.starthotspot(self.enter,viz.CIRCLE_HOTSPOT_IN,HOTSPOT_X,HOTSPOT_Z,RADIUS)

import math
viz.startlayer(viz.LINES)
viz.linewidth(3)
viz.vertexcolor(viz.RED)
viz.vertex(HOTSPOT_X,0,HOTSPOT_Z)
viz.vertex(HOTSPOT_X,2,HOTSPOT_Z)
viz.startlayer(viz.LINE_LOOP)
for a in range(0,360,10):
	x = math.sin(viz.radians(a))*RADIUS
	z = math.cos(viz.radians(a))*RADIUS
	viz.vertex(x+HOTSPOT_X,0.1,z+HOTSPOT_Z)
viz.endlayer()

# uncomment here and:
# enter activates at the beginning
# leave activates at your first move (anywhere)
#viz.addVideo('mona.mpg')

HotspotClass(0,1)
HotspotClass(2,3)

# uncomment here and:
# both enter and leave activate when you enter the hotspot
# but never again
#viz.addVideo('mona.mpg')
Reply With Quote
  #2  
Old 01-28-2008, 09:26 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I ran your sample script with the uncommented lines and everything worked fine. Were you able to reproduce the problem with this exact script?
Reply With Quote
  #3  
Old 01-28-2008, 09:49 AM
eirc eirc is offline
Member
 
Join Date: Jan 2008
Posts: 2
yeah and I still can't get it to wok :S
could this have something to have with the version I am running?
it's 3.00.2155
or that it's the trial version?

(you sure you uncommented the addvideo lines? :P)
Reply With Quote
  #4  
Old 01-29-2008, 08:58 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I commented out each one individually and I also uncommented both lines, and they all worked fine. The version you have should work fine, the latest version is 3.00.2317.
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 12:27 PM.


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