Collision Example 2

collision2.py
 1# © 2024 Autodesk, Inc. All rights reserved.
 2
 3# Collsion demo
 4
 5newScene()
 6
 7########################
 8# create some geometry #
 9########################
10
11obja = createBox(1, 1, 1, 1, 1, 1, 1, 0, 0, 0)
12obja.makeTransform()
13obja.setTranslation(-5, 0, 0)
14
15objb = createBox(1, 1, 1, 1, 1, 1, 0, 1, 0, 0)
16objb.makeTransform()
17objb.setTranslation(5, 0, 0)
18
19objc = createBox(1, 1, 1, 1, 1, 1, 0, 0, 1, 0)
20objc.makeTransform()
21objc.setTranslation(-5, 5, 0)
22
23objd = createBox(1, 1, 1, 1, 1, 1, 0, 1, 1, 0)
24objd.makeTransform()
25objd.setTranslation(5, 5, 0)
26
27updateScene()
28
29##################################
30# create a collision object that #
31# prints a message if any of the #
32# supplied objects collide       #
33##################################
34
35coll = vrCollision([obja, objb, objc, objd], [obja, objb, objc, objd])
36coll.connect("print 'WUMM'")
37
38print("just move any box so it collides another one.")
39