Axis rotation example¶
axisrotation.py¶
1# © 2024 Autodesk, Inc. All rights reserved.
2
3print("Executing axisrotation script!")
4
5newScene()
6loadGeometry("$VRED_EXAMPLES/geo/axis_rotation.osb")
7updateScene()
8calcVertexNormals()
9
10# For the axis rotation we need a new
11# transformation node we can't use the
12# already existing "cube" transformation node!
13# Well "Box" is not a unique name so we
14# search via path.
15# We also use wildcards for matching the long
16# group names in the root.
17cube = findNodePath("*/*/A/Box", True);
18cube.makeTransform()
19
20axis = findNode("Box_Axis");
21
22# define rotation of cube around axis from 0 to 359 degrees in 8 seconds
23cubeInt = vrInterpolator()
24cubeSlide = vrRotationAxisSlide(cube, axis, 0, 359, 8.0)
25cubeInt.add(cubeSlide)
26cubeInt.setActive(true)
27
28print("cube is rotating around its center")