Hello, I want to use RBC, but I can’t get it to work (it’s the first time I’m using it, sorry if the question is trivial). In the following example, I have a cube, I collect it, and on an event I try to move it. But it doesn’t move. Where is my mistake? Very thanks!
import direct.directbase.DirectStart
from pandac.PandaModules import RigidBodyCombiner, NodePath, Vec3
from direct.showbase import DirectObject
class World( DirectObject.DirectObject ):
def __init__( self ):
self.rbc = RigidBodyCombiner( 'rbc' )
self.rbcnp = NodePath( self.rbc )
self.rbcnp.reparentTo( render )
self.box = loader.loadModel( 'models/box' )
self.box.setPos( 0, 0, 0 )
self.box.reparentTo( self.rbcnp )
self.rbc.collect()
base.camera.setPos( 0, -5, 5 )
base.camera.lookAt( 0, 0, 0 )
base.disableMouse()
self.accept( 'f1', self.moveBox )
def moveBox( self ):
self.box.setPos( Vec3( 1, 0, 0 ) )
World()
run()