WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   How to call same function 50 times and every time new value need to save? (https://forum.worldviz.com/showthread.php?t=6213)

Vishav 12-05-2018 05:13 AM

How to call same function 50 times and every time new value need to save?
 
Hi

My environment has an avatar.

Avatar randomly points to objects placed in left or right (target object) in one trial.

I have total 48 targets i.e. 48 trials having with two objects one target and one distractor.

I have fixed function for left and right pointing but every time any two only objects should ON from 48 objects.

How I can easily write concisely?

Jeff 12-05-2018 08:44 PM

Add all the targets to a list. For each trial use the random module to select two values between 1-48. Then turn on the visibility of the two targets in the list with matching indices.

Vishav 12-06-2018 10:05 PM

That is the issue. How to make list of all 50 objects with fixed position and how to call it by indices?

Vishav 12-07-2018 12:56 AM

For example I have 8 objects. My Code:
ob1=viz.add('D:\PhD\S_Study\Objects 3D\Radio.dae',pos=[-0.9,0.38,2.54],euler=[0,0,0],scale =(0.014,0.014,0.0045))
ob2=viz.add('D:\PhD\S_Study\Objects 3D\Helmet.dae',pos=[7.75,1.38,-5.3],euler=[0,0,0],scale =(0.9,0.9,0.9))
ob3=viz.add('D:\PhD\S_Study\Objects 3D\Thomas.dae',pos=[-0.4,0.55,2.2],euler=[0,0,0],scale =(0.015,0.0135,0.009))
ob4=viz.add('D:\PhD\S_Study\Objects 3D\Picture.dae',pos=[1.1,0.64,2.3],euler=[90,0,0],scale =(0.3,0.3,0.3))
ob5=viz.add('D:\PhD\S_Study\Objects 3D\Bottle.dae',pos=[0.9,0.5,2.2],euler=[0,0,0],scale =(1.7,1.7,1.7))
ob6=viz.add('D:\PhD\S_Study\Objects 3D\Laptop.dae',pos=[-0.25,0.4,2.82],euler=[0,0,0],scale =(0.0018,0.0018,0.0017))
ob7=viz.add('D:\PhD\S_Study\Objects 3D\Spoon.dae',pos=[-1.25,0.08,5.75],euler=[0,0,0],scale =(0.031,0.032,0.032))
ob8=viz.add('D:\PhD\S_Study\Objects 3D\Chain.dae',pos=[1.3,0.55,2.5],euler=[0,0,0],scale =(0.7,0.7,0.7))

ob1.visible(viz.OFF)
ob2.visible(viz.OFF)
ob3.visible(viz.OFF)
ob4.visible(viz.OFF)
ob5.visible(viz.OFF)
ob6.visible(viz.OFF)
ob7.visible(viz.OFF)
ob8.visible(viz.OFF)

I put all in list:
my_list=[ob1,ob2,ob3,ob4,ob5,ob6,ob7,ob8]

Now I want to ON two at a time (ob1 and ob2) (one target and one distractor)
For next trial I want ob3 and ob4 to be ON and so on....

Vishav 12-07-2018 08:53 PM

This is sorted...Thanks for valuable suggestions.


All times are GMT -7. The time now is 09:50 AM.

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