<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/9456" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2013-10-03T09:23:54+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/9456</id>

		<entry>
		<author><name><![CDATA[rookie86]]></name></author>
		<updated>2013-10-03T09:23:54+00:00</updated>

		<published>2013-10-03T09:23:54+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31883#p31883</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31883#p31883"/>
		<title type="html"><![CDATA[pure virtual method called: addRigidBody]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=31883#p31883"><![CDATA[
I've started with a simple tutorial, this works without problems:<br><br>working code<div class="codebox"><p>Code: </p><pre><code>//...                //create WorldbtDefaultCollisionConfiguration* config = new btDefaultCollisionConfiguration();btCollisionDispatcher* dispatcher = new btCollisionDispatcher(config);btBroadphaseInterface* broadphase = new btDbvtBroadphase();btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver();btDiscreteDynamicsWorld* world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, config);world-&gt;setGravity(btVector3(0,-10,0));//create ObjectbtCollisionShape* shape = new btBoxShape(btVector3(1,3,1));btTransform transform;transform.setIdentity();btVector3 localInertia(0,0,0);shape-&gt;calculateLocalInertia(40.0f, localInertia);    btDefaultMotionState* motionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1), btVector3(50,50,50)));btRigidBody* body = new btRigidBody( btRigidBody::btRigidBodyConstructionInfo(40.0f, motionState,shape, localInertia));world-&gt;addRigidBody(body);btVector3 position = body-&gt;getCenterOfMassPosition();std::cout &lt;&lt; position.getX() &lt;&lt; " " &lt;&lt; position.getY() &lt;&lt; " " &lt;&lt; position.getZ() &lt;&lt; std::endl;for(int i = 0; i &lt; 100; ++i){world-&gt;stepSimulation(6,10);position = body-&gt;getCenterOfMassPosition();std::cout &lt;&lt; position.getX() &lt;&lt; " " &lt;&lt; position.getY() &lt;&lt; " " &lt;&lt; position.getZ() &lt;&lt; std::endl;}//...</code></pre></div>Now i want to have all the world code in one class:<br><div class="codebox"><p>Code: </p><pre><code>class World{btDefaultCollisionConfiguration*m_Config;btCollisionDispatcher*m_Dispatcher;btBroadphaseInterface*m_Interface;btSequentialImpulseConstraintSolver*m_Solver;btDiscreteDynamicsWorld*m_World;public:World() {m_Config     = NULL;m_Dispatcher = NULL;m_Interface  = NULL;m_Solver     = NULL;m_World      = NULL;}void init(){m_Config = new btDefaultCollisionConfiguration();m_Dispatcher = new btCollisionDispatcher(m_Config);m_Interface = new btDbvtBroadphase();m_Solver = new btSequentialImpulseConstraintSolver();m_World = new btDiscreteDynamicsWorld(m_Dispatcher, m_Interface, m_Solver, m_Config);m_World-&gt;setGravity(btVector3(0,-10,0));}~World() {delete m_Config;delete m_Dispatcher;delete m_Solver;delete m_Interface;delete m_World;}void addObject(btRigidBody* body){m_World-&gt;addRigidBody(body);}void update(){m_World-&gt;stepSimulation(20,10);}};</code></pre></div>It compiles without problems but if i do WorldObject.addObject(object) on the same RigidBody i've created in the working code i get the following error message: "pure virtual method called terminate called without an active exception". If i comment out the "m_World-&gt;addRigidBody(body)" the code runs without problems. It looks like he calls the pure virtual function of btDynamicsWorld. <br><br>Can someone tell me where the problem is and how i can fix the problem?<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=10481">rookie86</a> — Thu Oct 03, 2013 9:23 am</p><hr />
]]></content>
	</entry>
	</feed>
