Skip to content
Häfner edited this page Apr 19, 2021 · 11 revisions

Scripting is the way to add logic, interaction and animations to the virtual scene. All features of PolyVR are accessible from scripts, including scene graph operations, content import or creation, physics, lightning, cameras and many more. The module is called 'VR', it's documentation is available through the button with the question mark. A simple script that accesses built-in functionality:

import VR
print VR.getVersion()

System and custom modules

Scripts are written in python, this allows to import any module installed on your system. This also allows to import your own python modules. The path to place your modules is the folder where your project lies. If you want to add more paths you can do this in an init script:

import sys
sys.path.append("my/module/path/myMod")

from myMod import mymod
reload(mymod) # only needed when the module code changed

# help(mymod) # print all members of your module
mymod.test()

this code starts the test function defined in mymod.py in the folder my/module/path/myMod. For this to work, an empty file named _init_.py has to be placed in my/module/path/myMod.

Built-in modules

In addition to the built-in documentation, the PolyVR modules are listed here.

Clone this wiki locally