WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Conveyor Belt demo (https://forum.worldviz.com/showthread.php?t=4908)

zorgblaubaer 01-09-2014 06:47 AM

Conveyor Belt demo
 
Hey everyone,

I am trying to get the Conveyor Belt demo to work with our system. I can grab the objects from the belt and let go of them again. But I can't seem to figure out how to get them counted towards the score. They are not getting recognized in the DropBin.update method.
Also, they are falling with a very high velocity and bounce of the ground or whatever they hit like a bouncy ball.
What am I doing wrong?

The only part of my code where I am interacting with the objects is this:

Code:

def updateGrabs():
        global grab
        if gripTracker.getButtonState() >= 2:
                if grab == False:
                        # check to see if the hand/thermometer intersects with an object in the scene
                        handPos = rightHandTracker.getPosition(viz.ABS_GLOBAL)
                        # go through each item the list and find out if any are in range
                        selectedItem = None
                        selectedItemDistance = 0.2# set min distance
                        for item in GrabObjects.grabObjects:
                                # find the closest inside of that distance
                                d = vizmat.Distance(handPos, item.getPosition(viz.ABS_GLOBAL))
                                if selectedItemDistance > d:
                                        selectedItem = item
                                        selectedItemDistance = d
                        if selectedItem:
                                grab = viz.grab(rightHandTracker,selectedItem)
        else:
                if grab != False:
                        grab.remove()
                        grab = False
       
vizact.onupdate(0,updateGrabs)


zorgblaubaer 01-14-2014 04:18 AM

I managed to solve both problems.

I got rid of the bouncyness by reseting the objects when the grab is removed:

Code:

else:
    if grab != False:
        grab.getDst().reset()
        grab.remove()
        grab = False

I got the objects being recognized by not removing the DropBin bounding boxes but rather make them invisible (and I also remove the objects from the scene as soon as they are inside of a bin)


All times are GMT -7. The time now is 01:46 PM.

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