WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-05-2016, 08:47 PM
Vaquero Vaquero is offline
Member
 
Join Date: Nov 2015
Posts: 62
Question how to check if specified number of targets are in proximity sensor?

Hey there! Can anyone tell me what's the best way to check, if a specified number of targets are inside a proximity sensor?

I have an experiment in which a person is required to move a specified number of targets into a proximity sensor in order to continue. On top of that, this should be done within a specified time, e.g. 5 seconds.

I tried something like:
Code:
...
...
def task1(numActiveTargets):
    import random 
    numTrials = 100
    
    for trial in xrange(numTrials):
        targetSensor = random.choice(sensors) #a list of sensors
        activeTargets = manager.getActiveTargets(sensor=targetSensor)
        if len(activeTargets) < numActiveTargets:
            yield vizproximity.waitEnter(sensor = targetSensor, target = targets) #seems to be activated by any target in list of targets
            
        yield viztask.waitTime(5)

def experiment():
    yield task1(2)
    yield task1(3)

viztask.schedule(experiment)
...but it wouldn't work. Like, I'd have to check for 5 seconds if my chosen sensor contains at least 3 targets, for example.
Reply With Quote
 

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
delaying proximity reaction makes sensor unresponsive for the time of delay jelly Vizard 4 11-23-2016 04:20 AM
sensor radius bug? lalechuza Vizard 7 08-25-2015 05:57 AM
Orientation selective (Viewing Vector) Proximity Sensor lmGehrke Vizard 2 03-17-2015 12:31 PM
Proximity Sensor Problem kmkm Vizard 3 03-04-2014 11:54 AM
CompositeShape proximity sensor mhtong Vizard 1 09-24-2012 11:18 AM


All times are GMT -7. The time now is 01:19 AM.


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