Skip to content

Adding Physics

See the physics example in the exampleScripts folder. There is also a "Physics_GUI" example that allows you to set physics on any checked objects. For more on physics see the Vizard Documentation

To see how to toss objects with more velocity, see the example "Tossing_Objects". Note, to grab and toss with physics use the "head and hands" avatar. There is a vizconnect for this for the Meta Quest Pro called "Head and Hands OpenXR". Contact support@worldviz.com if you need one for another headset. 

Add this line of code towards the top of your script (for multi-user on both the server and client): 

viz.phys.enable()

Access the gaze objects manually and apply physics using this code in your experiment function. For Multi-User you need to add this code to both the experiment function on the client and the "recordWithTimer" function for the server. 

environmentModel = objects[0]
    environmentModel.collideMesh()
    environmentModel.hint(viz.OPTIMIZE_INTERSECT_HINT)
    basketball = env.getChild('basketball')
    sightlab.addSceneObject('basketball', grab = True)
    basketball.collideSphere()
#You can also just add a collidePlane to the env to create a floor plane
env = vizfx.addChild("sightlab_resources/environments/dojo.osgb")
env.collidePlane()