don't reset the simulation (in C++), when pressing some VR button
add some little tests in vrEvent.py
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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]
|
||||
Reference in New Issue
Block a user