summaryrefslogtreecommitdiff
path: root/examples/pybullet/pybullet.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pybullet/pybullet.c')
-rw-r--r--examples/pybullet/pybullet.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/examples/pybullet/pybullet.c b/examples/pybullet/pybullet.c
index 9946da3cf..5b8ca6e5b 100644
--- a/examples/pybullet/pybullet.c
+++ b/examples/pybullet/pybullet.c
@@ -1942,7 +1942,7 @@ static PyObject* pybullet_loadSoftBody(PyObject* self, PyObject* args, PyObject*
int physicsClientId = 0;
int flags = 0;
- static char* kwlist[] = {"fileName", "scale", "mass", "collisionMargin", "physicsClientId", NULL};
+ static char* kwlist[] = {"fileName", "basePosition", "baseOrientation", "scale", "mass", "collisionMargin", "physicsClientId", NULL};
int bodyUniqueId = -1;
const char* fileName = "";
@@ -1952,10 +1952,36 @@ static PyObject* pybullet_loadSoftBody(PyObject* self, PyObject* args, PyObject*
b3PhysicsClientHandle sm = 0;
- if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|dddi", kwlist, &fileName, &scale, &mass, &collisionMargin, &physicsClientId))
+ double startPos[3] = {0.0, 0.0, 0.0};
+ double startOrn[4] = {0.0, 0.0, 0.0, 1.0};
+
+
+ PyObject* basePosObj = 0;
+ PyObject* baseOrnObj = 0;
+
+ if (!PyArg_ParseTupleAndKeywords(args, keywds, "s|OOdddi", kwlist, &fileName, &basePosObj, &baseOrnObj, &scale, &mass, &collisionMargin, &physicsClientId))
{
return NULL;
}
+ else
+ {
+ if (basePosObj)
+ {
+ if (!pybullet_internalSetVectord(basePosObj, startPos))
+ {
+ PyErr_SetString(SpamError, "Cannot convert basePosition.");
+ return NULL;
+ }
+ }
+ if (baseOrnObj)
+ {
+ if (!pybullet_internalSetVector4d(baseOrnObj, startOrn))
+ {
+ PyErr_SetString(SpamError, "Cannot convert baseOrientation.");
+ return NULL;
+ }
+ }
+ }
sm = getPhysicsClient(physicsClientId);
if (sm == 0)
@@ -1971,6 +1997,9 @@ static PyObject* pybullet_loadSoftBody(PyObject* self, PyObject* args, PyObject*
b3SharedMemoryCommandHandle command =
b3LoadSoftBodyCommandInit(sm, fileName);
+ b3LoadSoftBodySetStartPosition(command, startPos[0], startPos[1], startPos[2]);
+ b3LoadSoftBodySetStartOrientation(command, startOrn[0], startOrn[1], startOrn[2], startOrn[3]);
+
if (scale > 0)
{
b3LoadSoftBodySetScale(command, scale);