WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 10-14-2008, 02:34 PM
TrashcanPatrol TrashcanPatrol is offline
Member
 
Join Date: Aug 2008
Posts: 43
Hi thank you for your response, I've tried what you said but it doesn't work still. Here is what I tried:

Code:
import viz
viz.go()

SAFE = 1
UNSAFE = 2
TARGET = 3



CIRCLE_X = -3.5
CIRCLE_Z = 3.4
CIRCLE_RADIUS = 0.5

def handlemyhotspots(id,x,y,z):

	if id == SAFE:
		print 'inside safe zone'
		def mykeyboard(key):
			if key == 'e':
			door.runAction( vizact.spinto(0,1,0, -90, 30.0) )
		viz.clearcolor(1,1,1)
		viz.starthotspot(UNSAFE,viz.RECTANGLE_HOTSPOT_OUT,0,3,2.4,6)

	elif id == UNSAFE:
		print 'outside safe zone'
		viz.clearcolor(0,0,0)
		viz.starthotspot(SAFE,viz.RECTANGLE_HOTSPOT_IN,0,3,2.4,6)

	elif id == TARGET:
		print 'at target'

viz.callback(viz.HOTSPOT_EVENT, handlemyhotspots)
viz.starthotspot(UNSAFE,viz.RECTANGLE_HOTSPOT_OUT,0,3,2.4,6)
viz.starthotspot(TARGET,viz.CIRCLE_HOTSPOT_IN,CIRCLE_X,CIRCLE_Z,CIRCLE_RADIUS) 

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


room=viz.add('room.wrl')
viz.collision(viz.ON)
door = room.getchild('door-FACES')
import vizcam
vizcam.FlyNavigate()

def mykeyboard(key):
  if key == 'e' and id == SAFE:
    door.runAction( vizact.spinto(0,1,0, -90, 30.0) )
--but it doesn't let me open the door like that though. The boldened part I know won't work [and it's not in my code that I was just using] but that's what I'm trying to do with it, it's hard to describe using two definitions with words though.
What do you think I should do for that?
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 11:29 PM.


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