Vizard 7 » Tutorials & Examples » Viewpoints & windows » Viewpoint collision » Tutorial: Viewpoint collision
7.7

Tutorial: Viewpoint collision

This tutorial will show you how to use Vizard's built-in collision detection.  The built-in collision detection will detect when the viewpoint has collided with another object in the scene and stop the viewpoint from moving any further. It will NOT detect collisions between two objects.

This content is discussed in more detail in the reference section.

Setting up a collision world

If you have trouble getting the code in this tutorial to work, you can find the complete example script viewCollision.py in the \tutorials\views directory.

 

After creating the empty script and add the following initial code to it:

import viz

viz.setMultiSample(4)
viz.fov(60)
viz.go()

viz.addChild('playground.wrl')
viz.clearcolor(viz.SKYBLUE)

Playground is a collection of objects that we can use to test colliding, going up steps automatically, and falling off automatically.

Setting up a collision world

Enabling collision detection

Gravity

Step height