Hi,
I was trying to port the Setup part of the Python code in the example here https://www.panda3d.org/manual/index.php?title=Bullet_Softbody_Rope&language=python but I’m getting the following errors which I’m not sure how to fix:
1>c:\panda3d-1.9.0-x64\include\bulletsoftbodynode.h(124): error C2061: syntax error : identifier 'BulletRigidBodyNode'
1>c:\panda3d-1.9.0-x64\include\bulletsoftbodynode.h(126): error C2061: syntax error : identifier 'BulletRigidBodyNode'
1>c:\panda3d-1.9.0-x64\include\bulletsoftbodynode.h(128): error C2535: 'void BulletSoftBodyNode::append_anchor(int)' : member function already defined or declared
1> c:\panda3d-1.9.0-x64\include\bulletsoftbodynode.h(124) : see declaration of 'BulletSoftBodyNode::append_anchor'
This is the code:
#include "bulletSoftBodyNode.h"
#include "bulletWorld.h"
#include "bulletSoftBodyWorldInfo.h"
#include "pandaFramework.h"
#include "windowFramework.h"
AsyncTask::DoneStatus UpdatePhysics(GenericAsyncTask* task, void* data);
BulletWorld* GetPhysicsWorld();
int _tmain(int argc, char* argv[])
{
PandaFramework* framework;
framework = new PandaFramework();
// Init everything :D
framework->open_framework(argc, argv);
framework->set_window_title("FPF Server");
WindowFramework* window = framework->open_window();
//from panda3d.bullet import BulletSoftBodyNode
//info = self.world.getWorldInfo()
//static BulletWorld* physicsWorld = new BulletWorld();
BulletSoftBodyWorldInfo worldInfo();
btSoftBodyWorldInfo info;
BulletSoftBodyWorldInfo winfo(info);
winfo.set_air_density(1.2);
winfo.set_water_density(0);
winfo.set_water_offset(0);
winfo.set_water_normal(LVector3(0, 0, 0));
int res = 8;
LPoint3 p1 = LPoint3(0, 0, 4);
LPoint3 p2 = LPoint3(10, 0, 4);
int fixeds = 0;
static PT(BulletSoftBodyNode) bodyNode = BulletSoftBodyNode::make_rope(winfo, p1, p2, res, fixeds);
bodyNode->set_total_mass(50.0);
NodePath bodyNP = window->get_render().attach_new_node(bodyNode);
GetPhysicsWorld()->attach_soft_body(bodyNode);
static AsyncTaskManager* taskManager = AsyncTaskManager::get_global_ptr();
GenericAsyncTask* physicsTask = new GenericAsyncTask("update physics", &UpdatePhysics, (void*) NULL);
taskManager->add(physicsTask);
framework->main_loop();
framework->close_framework();
return 0;
}
AsyncTask::DoneStatus UpdatePhysics(GenericAsyncTask* task, void* data)
{
ClockObject *co = ClockObject::get_global_clock();
GetPhysicsWorld()->do_physics(co->get_dt(), 10, 1.0 / 180.0);
return AsyncTask::DS_cont;
}
BulletWorld* GetPhysicsWorld()
{
static BulletWorld* physicsWorld = new BulletWorld();
return physicsWorld;
}
Cheers,
Zobbo