From 9c12e4edb0a996cf740a014162a50a73fe1dea94 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Mon, 26 Dec 2016 21:08:10 -0800 Subject: [PATCH] don't reset the simulation (in C++), when pressing some VR button add some little tests in vrEvent.py --- examples/SharedMemory/PhysicsServerExample.cpp | 4 ++-- examples/pybullet/vrEvent.py | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/SharedMemory/PhysicsServerExample.cpp b/examples/SharedMemory/PhysicsServerExample.cpp index 804007cc1..4a7fa4686 100644 --- a/examples/SharedMemory/PhysicsServerExample.cpp +++ b/examples/SharedMemory/PhysicsServerExample.cpp @@ -1030,7 +1030,7 @@ public: if (args.CheckCmdLineFlag("robotassets")) { -// gCreateDefaultRobotAssets = true; + gCreateDefaultRobotAssets = true; } if (args.CheckCmdLineFlag("norobotassets")) @@ -1859,7 +1859,7 @@ void PhysicsServerExample::vrControllerButtonCallback(int controllerId, int butt { if (button == 1 && state == 0) { - gResetSimulation = true; + //gResetSimulation = true; //gVRTeleportPos1 = gLastPickPos; } } else diff --git a/examples/pybullet/vrEvent.py b/examples/pybullet/vrEvent.py index e52a2faea..4112defd9 100644 --- a/examples/pybullet/vrEvent.py +++ b/examples/pybullet/vrEvent.py @@ -7,7 +7,8 @@ import pybullet as p #assume that the VR physics server is already started before p.connect(p.SHARED_MEMORY) - +p.setInternalSimFlags(0)#don't load default robot assets etc +p.resetSimulation() p.loadURDF("plane.urdf") prev=[None]*p.VR_MAX_CONTROLLERS @@ -32,8 +33,14 @@ while True: widths[e[0]]=widths[e[0]]+1 if (widths[e[0]]>20): widths[e[0]] = 1 + if (e[6][1]&2): + p.resetSimulation() + #p.setGravity(0,0,-10) + p.removeAllUserDebugItems() + p.loadURDF("plane.urdf") if (e[6][33]==1): pt = prev[e[0]] + #print(prev[e[0]]) #print(e[1]) diff = [pt[0]-e[1][0],pt[1]-e[1][1],pt[2]-e[1][2]] @@ -41,5 +48,6 @@ while True: ptDistThreshold = 0.01 if (lenSqr>(ptDistThreshold*ptDistThreshold)): p.addUserDebugLine(e[1],prev[e[0]],colors[e[0]],widths[e[0]]) + #p.loadURDF("cube_small.urdf",e[1]) colors[e[0]] = [1-colors[e[0]][0],1-colors[e[0]][1],1-colors[e[0]][2]] prev[e[0]] = e[1] \ No newline at end of file