Vizconnect’s viewpoint collision is used to stop the user’s avatar and viewpoint from moving through other objects in the scene. It is designed to create a seamless collision effect when combining trackers, transports, custom navigation nodes, and an avatar to drive the viewpoint. Vizard includes another viewpoint collision method that works well with standard desktop navigation (e.g. mouse, keyboard). However, during a collision, the avatar, transport, or custom navigation node that is a parent of the viewpoint may keep moving after the viewpoint stops. Viewpoint collision works best with virtual trackers (e.g. mouse, keyboard) and virtual navigation techniques (e.g. transport). If a physical tracker is used, the user can potentially walk past a virtual boundary but the viewpoint will stop. The result is a mismatch between the user’s physical and virtual positions.
Vizconnect’s collision method requires that an avatar is added to the configuration. It checks for collisions against an avatar object and moves up the scenegraph chain to modify any node that’s driving it.
The following example adds the maze model and enables vizconnect's viewpoint collision. Before running the script, create a configuration file with a head and hands avatar:
Run the script and test collisions with the maze walls using both tracker and transport navigation:
Press the 'x' and 'z' keys to move the transport up and down. Notice how the viewpoint moves through the ceiling and floor. The avatar collision constructor accepts an argument to enable vertical collisions. Change:
to:
Run the script again and see how the viewpoint stops at the ceiling and floor.
The collide list specifies whether the avatar head, avatar base, or both cause collisions with the environment. So far, only the avatar head has been used for collisions:
Add the following lines of code to the end of the script. This adds a cube that can be moved up and down using the '1' and '2' keys. Run the script and navigate over the cube. Turn around so the cube is in view, then lift the cube to head height by pressing '1' a few times. At this height the viewpoint will collide with the cube:
Next, modify the collide list to include collisions with the avatar base:
Run the script again and notice how collisions occur with the cube at ground level.
A group node can be used for custom navigation by placing it at the top of the scenegraph and updating it’s transform every frame. The collision detection will take into account any node that is above the avatar.
Run the vizconnect file and go to the Trackers tab. Press the Add a New Tracker button, select the Group tracker option, and press Apply & Exit. Then parent the transport to the group node in the scenegraph:
Next, updates are applied to the group tracker’s position every frame. Add the following code to the end of the script:
Run the script and see how the collision detection works with the group node’s movements. Toggle the automatic position updates on and off by pressing the spacebar.