WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 22 votes, 5.00 average. Display Modes
  #1  
Old 03-07-2013, 01:04 PM
mshukun mshukun is offline
Member
 
Join Date: Jan 2013
Posts: 32
360 panorama image cube using as darts target and record the xy coordinates

Greetings. I am a GIS Analyst and would like to use the 360 panorama image cube as walls so that users of the program can create 'marks' on the 360 panorama image cube (e.g. like a darts game); in this regard I plan to record the xy coordinates of locations marked by users throwing a beach ball in a given direction.

I currently am engaging in research using Vizard software with a head mounded display device (zSight). I have been learning the relevant programming skills using tutorials and examples provided by Worldviz. However, I am not a gaming programmer and am having difficulties with specific aspects the required programming.

In order to more specifically describe my difficulties, I have recreated a framework of my research environment using resources provided by Worldviz, as per the code shown below. All codes are from the 360 panorama and duck court examples. (Please note that I do not have access to more advanced software like 3ds Max, so if I need to create 3D objects then Google Sketchup is my only choice.)

I am having the following three difficulties:

  1. Is it possible to create 'marks' for the user-identified location points on the 360 panorama image cube excluding the top and bottom (much like the 'push pins' or 2D circles that identify specific locations on a Google map)? If not, how would be best to mark a given user-designated location? (Please note that I used 'beachball.osgb' in the code posting, and shot balls go forever since velocity is constant and the 360 panorama image cube presents no obstacles to stop the ball -- the idea is that shot beach balls are required to stick on the 360 panorama image);
  2. How do I assign or retrieve XY coordinates for recording? (For example, a North cube face [x, y] , a 'negx' face [x, y], and so on...); and
  3. I am using 'crosshair.png' to replace a mouse arrow pointer. However, I have both a crosshair and mouse arrow pointer when I execute the program. How should I replace the arrow pointer with a crosshair?

I very much appreciate any assistance you could provide in this regard.

Thanks so much!

Code:
import viz

viz.setMultiSample(4)
viz.fov(60)
viz.go()

env = viz.addEnvironmentMap('townhall_L.jpg')
sky = viz.addCustomNode('skydome.dlc')
sky.texture(env)


NUM_BALLS	= 3 
BALL_SPEED	= 5 

viz.link( viz.Mouse , viz.addTexQuad(viz.SCREEN,texture=viz.add('crosshair.png')) )


balls = []

#Enable physics, but don't use gravity
viz.phys.enable()
viz.phys.setGravity([0,0,0])

#Initialize all the balls
for x in range(NUM_BALLS):
	#Create a ball
	ball = viz.addChild('beachball.osgb',pos=(0,0,-40),cache=viz.CACHE_CLONE)

	#Enable collisions with the ball based on a sphere shape
	ball.collideSphere()

	#We want to be notified of the balls collisions
	ball.enable(viz.COLLIDE_NOTIFY)

	#Add the ball to the ball list
	balls.append(ball)

#Create cycle for balls
nextBall = viz.cycle(balls)

#Shoot a ball
def shootBall():
	#Find the next available ball to shoot
	ball = nextBall.next()

	#Calculate the vector of the ball based on the mouse position
	line = viz.MainWindow.screenToWorld(viz.mouse.getPosition())
	line.length = BALL_SPEED

	#Translate the ball to the head position
	ball.setPosition(line.begin)

	#Reset ball and set velocity
	ball.reset()
	ball.setVelocity(line.dir)

	#Play the gunshot sound
	viz.playSound('gunshot.wav')

#Shoot a ball whenever left mousebutton is clicked
vizact.onmousedown(viz.MOUSEBUTTON_LEFT,shootBall)

#Make sure balls maintain constant velocity
def UpdateVelocity():
	for ball in balls:
		ball.setVelocity(viz.Vector(ball.getVelocity(),length=BALL_SPEED))
vizact.ontimer(0,UpdateVelocity)
Reply With Quote
  #2  
Old 03-13-2013, 03:49 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Here's an example that places markers around the panorama:
Code:
import viz
import vizmat
import vizshape

viz.setMultiSample(4)
viz.fov(60)
viz.go()

env = viz.addEnvironmentMap('townhall_L.jpg')
sky = viz.addCustomNode('skydome.dlc')
sky.texture(env)

viz.link( viz.Mouse , viz.addTexQuad(viz.SCREEN,texture=viz.add('crosshair.png')) )
viz.mouse.setVisible(viz.OFF)

def placeMarker():
	line = viz.MainWindow.screenToWorld(viz.mouse.getPosition())
	pos = vizmat.MoveAlongVector(line.begin,line.dir,40)
	shape = vizshape.addCircle()
	shape.color(viz.RED)
	shape.billboard()
	shape.setPosition(pos)
	
#place a marker when the left mouse is pressed
vizact.onmousedown(viz.MOUSEBUTTON_RIGHT,placeMarker)

import vizcam
vizcam.PanoramaNavigate()
Reply With Quote
  #3  
Old 03-14-2013, 07:17 AM
mshukun mshukun is offline
Member
 
Join Date: Jan 2013
Posts: 32
360 panorama xyz coordinate

Dear Jeff,

Thank you so much for your help!! I was so excited to receive your response for my posting, since the forum represents the only venue for me to seek help at this time. Thanks to you, the forum worked wonderfully for this purpose! This project marks the first attempt in my organization to integrate GIS functionalities into virtual reality software, and it is very challenging for me. However, I am very pleased that with the Vizard software the required application can be created with very little coding since the software provides many convenient modules.

I would like to kindly ask you another question: I was able to obtain xyz coordinates and am wondering how the imported image is scaled in Vizard. For example, I use 955 x 955 images to create a 360 panorama, and Vizard then re-scales such images to 1024 x 1024 and creates an approximately 100 x 100 x 100 m environment. How does Vizard assign the scale from such images?

Again, thank you so much for your help. It is very, very much appreciated.
Reply With Quote
Reply

Tags
360 panorama, darts game, xy coordinates


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:21 PM.


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