WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 03-17-2009, 05:36 PM
durf durf is offline
Member
 
Join Date: Feb 2009
Posts: 61
Still not working... Below is the code I have created for it. Im thinking it has something to do with the array. Just getting confused with it.

Code:
import viz
viz.go()

OriginalPillar = viz.add('pillarWRL.wrl')
OriginalPillar.visible(viz.OFF)

viz.MainView.setPosition([0,10,-35]) #sets camera position
viz.MainView.setEuler([0,2,0]) #sets camera pitch

PORT_PPT = 6

numLights = viz.input('How many lights are you tracking?')
numLights = min(8,numLights)

for x in range(numLights): #creates sensor and call
	
	#Add ground
	ground = viz.add( 'tut_ground.wrl' )
	ground.setPosition([0,-5,0])
	
	#Create sensor
	ppt = viz.add('vizppt.dls')
	
	#Create ball
	ball = viz.add('white_ball.wrl')
	ball.scale(1,1,1)
	ballLink = viz.link(ppt, ball)
	#controls distance in virtual world
	ballLink.postScale([8,1,13],target = viz.LINK_FULL_OP)

	columns = [-20, -10, 0, 10, 20]
	rows = [0, 6, 12, 18]
pillars = []
for x in columns:  #creates an array of pillars
	for y in rows:
		pillar = OriginalPillar.copy()
		pillar.translate(0+x, 0, 0+y)
		pillar.setScale(1,1,1)
		pillar.visible(viz.OFF)
		pillars.append(pillar)

number = 0
def showPillar(): #displays pillars
	global number
	pillars[number].visible(viz.ON)
	number +=1
vizact.ontimer2(.5,len(pillars)-1,showPillar)

currentBlock = None
def moveblock():

	global currentBlock
	
	x,y,z = ball.getPosition()
	info = viz.intersect([x,y-1,z],[x,y-20,z])
	if info.valid and currentBlock == None:
		currentBlock = info.object
		currentBlock.setPosition([0,-10,0], viz.REL_LOCAL)
	elif not info.valid and currentBlock is not None:
		currentBlock.setPosition([0,10,0], viz.REL_LOCAL)
		currentBlock = None
		
vizact.ontimer(0, moveblock)
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
retrieve Object names Geoffrey Vizard 11 12-11-2009 04:26 AM
Can you link the position of a tracker to the orientation of an object? michaelrepucci Vizard 1 09-19-2008 10:23 AM
Child Object Rotation paulgoldberg Vizard 5 09-05-2006 11:33 AM
when collision mode is on, can i "turn it off" for an individual object? Vdoug Vizard 1 09-22-2005 12:14 PM
rotate to object jargon Vizard 1 08-08-2005 12:20 PM


All times are GMT -7. The time now is 06:31 PM.


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