turntable demo

turntable.py
 1# © 2024 Autodesk, Inc. All rights reserved.
 2
 3print("Executing turntable script!")
 4
 5# Everything behind # is a comment!
 6
 7newScene()
 8
 9loadGeometry("$VRED_EXAMPLES/geo/turntable.osb")
10updateScene()
11
12# Searches for the node with the name "podest"
13turntable = findNode("turntable");
14turntable.makeTransform()
15center = turntable.getCenter();
16
17# create interpolator for rotation
18turntableInt = vrInterpolator()
19
20# This rotates about the z-axis from angle (0, 0, 0) to (0, 0, 359) in 8 seconds.
21#turntableSlide = vrRotationSlide(turntable, 0, 0, 0, 0, 0, 359, 8.0)
22
23# You can also define a rotation axis via 2 points.
24# we use the center of the object.
25turntableSlide = vrRotationAxisSlide(turntable, center[0], center[1], center[2],   center[0], center[1] , center[2] + 1.0,  0, 359, 8.0)
26turntableInt.add(turntableSlide)
27
28# define key r to toggle rotation of the turntable
29keyR = vrKey(Key_R)
30keyR.connect(turntableInt, SWITCH_TOGGLE)
31vrLogWarning("Press r to rotate.")