In [1]:
import sys
sys.path.append('../build')
import numpy as np
import libry as ry
from time import sleep

In [2]:
C = ry.Config()
D = C.view()

In [3]:
C.addFrame('world')
block = C.addObject(name='block', shape=ry.ST.ssBox, size=[.2,.3,.5,.02], pos=[.0,.0,.5], color=[1,0,0])
block.setMass(1.);
C.addObject('finger', shape=ry.ST.ssBox, size=[.3, .1, .1, .02], color=[1.,1.,1.,.3], parent='world', pos=[1., 0., .45])


Out[3]:
<libry.Frame at 0x7fefd0b9ddc0>

In [4]:
# this fails, if the lib was not compiled with bullet (comment #BULLET=0 in config.mk)
P=C.physx()
#P=C.bullet()


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-4-bf964f18d239> in <module>
      1 # this fails, if the lib was not compiled with bullet (comment #BULLET=0 in config.mk)
----> 2 P=C.physx()
      3 #P=C.bullet()

AttributeError: 'libry.Config' object has no attribute 'physx'

In [5]:
x = C.getFrameState('finger')
for i in range(1,100):
    x[0] -= .01
    C.setFrameState(x, ['finger'])
    P.step(C)
    sleep(0.01)

In [6]:
V = P.getState(C)
X = C.getFrameState()

In [10]:
#run this cell multiple times! It resets bullet always to the same state
C.setFrameState(X)
x = C.getFrameState('finger')
P.setState(C,V)
for i in range(1,100):
    x[0] -= .01
    C.setFrameState(x, ['finger'])
    P.step(C)
    sleep(0.01)

In [8]:
P=0
D=0
C=0

In [ ]: