WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-11-2007, 08:00 PM
cookey cookey is offline
Member
 
Join Date: Sep 2007
Posts: 4
Red face creating floating menu

hi,
i'm a newbie in this programming world..
i'm trying to create a half transparent floating menu in a round shape as below..

i have try it for a fortnight but still cant get a solution..
can anyone please guide me?
thanks
Reply With Quote
  #2  
Old 09-12-2007, 11:20 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is a small example that should provide you with enough to get started. You can use the left/right arrow keys to rotate the menu. Let me know if something is not clear.
Code:
import viz
viz.go()

import math


QUADS = 8		#Number of menu quads
RADIUS = 2		#Radius of menu
ANGLE = (360.0 / QUADS)

#Create overlay window for floating menu, with its own view/scene
menuScene = viz.addScene()

menuView = viz.addView()
menuView.setScene(menuScene)

menuWindow = viz.addWindow()
menuWindow.setClearMask(viz.GL_DEPTH_BUFFER_BIT)
menuWindow.setPosition(0,1)
menuWindow.setSize(1,1)
menuWindow.viewpoint(menuView)


#Create root node for menu quads
menu = viz.addGroup(scene = menuScene)
menu.translate(0,1.8,5)

#Create texture to apply to quads
tex = viz.addTexture('ball.jpg')

#Add each menu quad
for x in xrange(QUADS):
	quad = viz.addTexQuad(parent=menu)
	
	angle = ANGLE * x
	
	x = math.sin( viz.radians(angle) ) * RADIUS
	z = math.cos( viz.radians(angle) ) * RADIUS
	
	quad.translate(x,0,z)
	quad.rotate(0,1,0,angle+180)
	quad.texture(tex)
	quad.alpha(0.7)

#Rotate menu using arrow keys
vizact.onkeydown(viz.KEY_LEFT,menu.addAction,vizact.spin(0,1,0,ANGLE*5,0.2))
vizact.onkeydown(viz.KEY_RIGHT,menu.addAction,vizact.spin(0,1,0,-ANGLE*5,0.2))

#Add some model to the normal scene
viz.add('gallery.ive')
Reply With Quote
  #3  
Old 09-17-2007, 07:15 PM
cookey cookey is offline
Member
 
Join Date: Sep 2007
Posts: 4
thanks

thanks..i'll let you know...
Reply With Quote
  #4  
Old 09-17-2007, 07:51 PM
cookey cookey is offline
Member
 
Join Date: Sep 2007
Posts: 4
hye...then how i'm going to declare each menu for each different screen?
i develop a different scene on differ .py file..then, i develop one menu.py, as a main scene , i wonder why i cant link to another .py file by following the scene tutorial??
Reply With Quote
  #5  
Old 09-18-2007, 05:06 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I'm sorry, I don't understand what you are asking. Can you explain it in more detail?
Reply With Quote
  #6  
Old 09-18-2007, 05:41 PM
cookey cookey is offline
Member
 
Join Date: Sep 2007
Posts: 4
(*^*)

hehe..sorry...
i had create a few different scene on different file..let's say scaffold.py and planetDemo.py. Then, i create a transparent menu as i ask before. then i tried to make the button function by click one of the button, and it can link to the scaffold.py file.but the problem is, it only function with .wrl but not .py?why does it happened?
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 04:25 PM.


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