WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-08-2016, 07:44 AM
jelly jelly is offline
Member
 
Join Date: Feb 2016
Posts: 38
Smile help with triggering an action

Hello!

I have a small problem because I don't know how to combine two actions.

I have a small texquad on the upper left corner of the screen and a list fo 4 pictures, that will be shown one after the other as textures to the quad. I want my trial function to go though all 4 pictures in the list. A left mouse button click shoul trigger the next picture. However, I want this to happen, only when the left mouse button is clicked AND when it is placed over the textquad (basically selecting the picture), but not when the lft mouse button is clicked anywhere else on the screen. Do you have any pointers that would get me in the right direction?

(I am a beginner with programming, I am not asking for debugging, this is just to see whether my rationale is completely off or whether I am already on the right track)

Here is what I have so far:

Code:


##########################

import viz 													
import vizshape												
import viztask												
import vizinput												
import time													
import random												
import linecache												
import vizact												
import itertools


viz.setMultiSample(4) 												
viz.fov(45)

#Start Vizard														
viz.go()

####~~~~~~~Setup~~~~~~~####

viz.mouse.setOverride(viz.ON)


#Set background colour
viz.clearcolor(viz.GRAY)				

#Make a screen window:
screen1 = viz.addTexQuad(size=0.5)            
screen1.setPosition([0.5,2.2,1.3])
screen1.setSize([0.2, 0.2])
screen1.setTexQuadDisplayMode(viz.TEXQUAD_FIXED)
screen1.visible(viz.ON)

myList = ['sil1.png', 'sil2.png', 'sil3.png', 'sil4.png']
myListIndex = 0

def click():
	object = viz.pick()
	if object == screen1:
		print 'picture'
		vizact.onmousedown(viz.MOUSEBUTTON_LEFT, click)

def trial():
	global myListIndex
	screen1.visible(viz.ON)
	for x in range(4):
		picture = viz.add(myList[myListIndex])
		screen1.texture(picture)
		viz.mouse.setVisible(viz.ON)
		vizact.onmousedown(viz.MOUSEBUTTON_LEFT, click)
		yield viztask.waitTime(3)
		myListIndex = myListIndex + 1
	screen1.visible(viz.OFF)


viztask.schedule(trial())

Thank you very much in advance for the help!

Best,
jelly
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Walking action of avatars SivaKartheek Vizard 3 01-08-2016 09:17 AM
Walking action of avatars(files are attached) SivaKartheek Vizard 1 12-15-2015 06:36 AM
walking action of avatars SivaKartheek Vizard 1 12-14-2015 10:58 PM
vizact move action andreionutz Vizard 13 11-19-2014 02:54 AM
adding more than 1 action for avatar animation slider control yak Vizard 0 07-21-2009 11:22 AM


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


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