|
发表于 2009-4-25 13:40:59
|
显示全部楼层
我一开始遇到你这个问题的原因是OSG版本太低,重新编译OSG2.8;
然后,修改_sceneDesc.simType = NX_SIMULATION_HW为SW就可以了;
按照box代码,我加了一段代码创建球,结果没有自由落体的效果。
球的代码如下:- //建立空间球对象
- osg::Node * createSphere( const osg::Vec3f& pos )
- {
- osg::Sphere* sphereShape = new osg::Sphere(osg::Vec3(0,0,0),10.0f);
-
- osgPhysics::RigidActor * sphereActor = new osgPhysics::RigidActor;
- sphereActor->addChannel(osg::Matrix::translate(pos),sphereShape,new osgPhysics::BodyBase);
-
- osg::Geode* sphereGeode = new osg::Geode;
- sphereGeode->addDrawable(new osg::ShapeDrawable(sphereShape));
- sphereActor->addChild(sphereGeode);
- return sphereActor;
- }
复制代码 |
-
程序截图
|