OgreNewt plus oFusion

kintaro

03-04-2006 19:18:54

Hi, I am trying to run oFusion with OgreNewt, in the way that I tried to add OgreNewt in a oFusion sample, oSceneLoader demo. The main code is below. In the case I putted a scene that load correctly, and the green ninja from ogre. Till here, everything is ok. When I add a box primitive to the ninja node, the compiler does not gives any error, but when I run the program, I see that in the ninja disapears in the first second that the programs begins to run. The program continue to run, does not crash, but the ninja disapears.

Thank for help to solve this program.

Here is the code:

#include "ExampleApplication.h"

// oScene loader library header file
#include "OgreOSMScene.h"

#include <OgreNewt.h>

// Callback handler to post-process created objects
class oSceneCallback : public OSMSceneCallbacks {
public:

// We override the OnCreate method for cameras (See IXMLSceneCallbacks class)
void OnCameraCreate(Ogre::Camera* pCamera, TiXmlElement* pCameraDesc) {

// If a camera of name "FirstCamera" is loaded, it will be set as the default current
if(pCamera->getName() == "FirstCamera")
Ogre::Root::getSingleton().getAutoCreatedWindow()->getViewport(0)->setCamera(pCamera);
}

};


// Event handler to animate
class oSceneLibDemoFrameListener : public ExampleFrameListener
{
protected:

SceneManager* mSceneMgr;

public:
oSceneLibDemoFrameListener(SceneManager* sceneMgr, RenderWindow* win, Camera* cam)
: mSceneMgr(sceneMgr), ExampleFrameListener(win, cam)
{
}


bool frameStarted(const FrameEvent& evt)
{

static Real timeDelay = 0;
static Real currentTime = 0;

timeDelay -= evt.timeSinceLastFrame;

// We can cycle cameras with the 'c' key
if (mInputDevice->isKeyDown(KC_C) && timeDelay <= 0) {

Camera* firstCam;
Camera* currentCam = mWindow->getViewport(0)->getCamera();

Viewport* vp = mWindow->getViewport(0);

SceneManager::CameraIterator it = mSceneMgr->getCameraIterator();

if(it.hasMoreElements())
firstCam = it.peekNextValue();

while(it.hasMoreElements()) {

Ogre::Camera* cam = it.getNext();

if(currentCam == cam) {
Ogre::Camera* camera = it.hasMoreElements() ? it.getNext() : firstCam;
vp->setCamera(camera);
}
}

timeDelay = 0.5f;

}

// We update all loaded animations each frame
SceneManager::AnimationIterator animationIt = mSceneMgr->getAnimationIterator();

while(animationIt.hasMoreElements()) {
Animation* animation = animationIt.getNext();

const Animation::TrackList& trackList = animation->_getTrackList();

Animation::TrackList::const_iterator it = trackList.begin();
Animation::TrackList::const_iterator iend = trackList.end();

for(; it != iend; ++it) {
const Ogre::AnimationTrack* track = it->second;
track->getAssociatedNode()->resetToInitialState();
}

currentTime += evt.timeSinceLastFrame;
animation->apply(currentTime);
}

// Call default
return ExampleFrameListener::frameStarted(evt);

}
};

class oSceneLibApplication : public ExampleApplication {
public:

oSceneLibApplication() {}

protected:

// Just override the mandatory create scene method
void createScene(void)
{
// Here is the code that will load the scene file
// A fixed filename "scene.osm" is implemented for this demo

// Create the scene loader
OSMScene oScene;

// Create an oE_Loader Callback object to post-process created objects
oSceneCallback oe_Callback;

// Initialises with the scene to be loaded and the callback if requiered
oScene.initialise("teste.osm", &oe_Callback);

// create and setup the scene in the root node
oScene.createScene();


mSceneMgr = oScene.getSceneManager();

mCamera = oScene.getCameraList().at(0);

/*// Create a default camera in case no cameras were saved in the scene
mCamera = mSceneMgr->createCamera("PlayerCam");
// Position it at 500 in Z direction
mCamera->setPosition(Vector3(0,0,500));
// Look back along -Z
mCamera->lookAt(Vector3(0,0,-300));*/
mCamera->setNearClipDistance(5);

// Create one viewport, entire window
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));

// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(
Real(vp->getActualWidth()) / Real(vp->getActualHeight()));

m_World = new OgreNewt::World();

//create ninja entity
Entity* mEntity;

mEntity = mSceneMgr->createEntity( "Ninja", "ninja.mesh" );

SceneNode* node;

node = mSceneMgr->getRootSceneNode()->createChildSceneNode();

node->attachObject(mEntity);

node->setPosition(mCamera->getPosition().x - 700, mCamera->getPosition().y + 100 , mCamera->getPosition().z);

node->scale(1,1,1);

OgreNewt::Collision* ent_col = new OgreNewt::CollisionPrimitives::Box( m_World, Ogre::Vector3( 20 , 100 , 20 ) );

OgreNewt::Body* ent_body = new OgreNewt::Body( m_World, ent_col );

Ogre::Vector3 ent_inertia = OgreNewt::MomentOfInertia::CalcBoxSolid( 10, Ogre::Vector3( 2 , 10 , 2) );

ent_body->setMassMatrix( 10 , ent_inertia );

ent_body->attachToNode( node );

mWindow->setDebugText(ent_body->getOgreNode()->getAttachedObject(0)->getName());

Ogre::Vector3 Up_Direction_1( 0 , 1 , 0 );

OgreNewt::BasicJoints::UpVector* Up_Vector_1;

Up_Vector_1 = new OgreNewt::BasicJoints::UpVector( m_World, ent_body, Up_Direction_1 );

Ogre::Vector3 Up_Direction_2 ( 1 , 0 , 0 );

OgreNewt::BasicJoints::UpVector* Up_Vector_2;

Up_Vector_2 = new OgreNewt::BasicJoints::UpVector( m_World, ent_body, Up_Direction_2 );

//ent_body->setStandardForceCallback();

delete ent_col;

//delete m_World;

}

// The scene manager will be created by the Scene Loader lib
void chooseSceneManager(void) {}
void createCamera(void) {}
void createViewports(void) {}

// Create new frame listener
void createFrameListener(void)
{
mFrameListener= new oSceneLibDemoFrameListener(mSceneMgr, mWindow, mCamera);
mRoot->addFrameListener(mFrameListener);

Ogre::FrameListener* mNewtonListener;

mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mCamera, mSceneMgr, m_World, 60 );
mRoot->addFrameListener(mNewtonListener);
}

private:

OgreNewt::World* m_World;

};


kintaro

03-04-2006 21:50:20

I worked on this problem, trying to change something, and realized that if I change the original position of the ent_body using setPositionOrietation, the ninja does not disapears anymore, and if I press f3 key, the box primitive appears, very nice, but nothing more happens, like I putted setStandardForceCallback(), but the ninja does not fall, even don't move in any direction if I put an setVelocity to ent_body.

My new code is below:

#include "ExampleApplication.h"

// oScene loader library header file
#include "OgreOSMScene.h"

#include <OgreNewt.h>

// Callback handler to post-process created objects
class oSceneCallback : public OSMSceneCallbacks {
public:

// We override the OnCreate method for cameras (See IXMLSceneCallbacks class)
void OnCameraCreate(Ogre::Camera* pCamera, TiXmlElement* pCameraDesc) {

// If a camera of name "FirstCamera" is loaded, it will be set as the default current
if(pCamera->getName() == "FirstCamera")
Ogre::Root::getSingleton().getAutoCreatedWindow()->getViewport(0)->setCamera(pCamera);
}

};


// Event handler to animate
class oSceneLibDemoFrameListener : public ExampleFrameListener
{
protected:

SceneManager* mSceneMgr;

public:
oSceneLibDemoFrameListener(SceneManager* sceneMgr, RenderWindow* win, Camera* cam)
: mSceneMgr(sceneMgr), ExampleFrameListener(win, cam)
{
}


bool frameStarted(const FrameEvent& evt)
{

static Real timeDelay = 0;
static Real currentTime = 0;

timeDelay -= evt.timeSinceLastFrame;

// We can cycle cameras with the 'c' key
if (mInputDevice->isKeyDown(KC_C) && timeDelay <= 0) {

Camera* firstCam;
Camera* currentCam = mWindow->getViewport(0)->getCamera();

Viewport* vp = mWindow->getViewport(0);

SceneManager::CameraIterator it = mSceneMgr->getCameraIterator();

if(it.hasMoreElements())
firstCam = it.peekNextValue();

while(it.hasMoreElements()) {

Ogre::Camera* cam = it.getNext();

if(currentCam == cam) {
Ogre::Camera* camera = it.hasMoreElements() ? it.getNext() : firstCam;
vp->setCamera(camera);
}
}

timeDelay = 0.5f;

}

// We update all loaded animations each frame
SceneManager::AnimationIterator animationIt = mSceneMgr->getAnimationIterator();

while(animationIt.hasMoreElements()) {
Animation* animation = animationIt.getNext();

const Animation::TrackList& trackList = animation->_getTrackList();

Animation::TrackList::const_iterator it = trackList.begin();
Animation::TrackList::const_iterator iend = trackList.end();

for(; it != iend; ++it) {
const Ogre::AnimationTrack* track = it->second;
track->getAssociatedNode()->resetToInitialState();
}

currentTime += evt.timeSinceLastFrame;
animation->apply(currentTime);
}

// Call default
return ExampleFrameListener::frameStarted(evt);

}
};

class oSceneLibApplication : public ExampleApplication {
public:

oSceneLibApplication() {}

~oSceneLibApplication()
{
// destroy world.
delete m_World;
}

protected:

// Just override the mandatory create scene method
void createScene(void)
{
// Here is the code that will load the scene file
// A fixed filename "scene.osm" is implemented for this demo

// Create the scene loader
OSMScene oScene;

// Create an oE_Loader Callback object to post-process created objects
oSceneCallback oe_Callback;

// Initialises with the scene to be loaded and the callback if requiered
oScene.initialise("teste.osm", &oe_Callback);

// create and setup the scene in the root node
oScene.createScene();


mSceneMgr = oScene.getSceneManager();

mCamera = oScene.getCameraList().at(0);

mCamera->setNearClipDistance(5);

// Create one viewport, entire window
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));

// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(
Real(vp->getActualWidth()) / Real(vp->getActualHeight()));

m_World = new OgreNewt::World();

//create ninja entity
Entity* mEntity;

mEntity = mSceneMgr->createEntity( "Ninja", "ninja.mesh" );

SceneNode* node;

node = mSceneMgr->getRootSceneNode()->createChildSceneNode();

node->attachObject(mEntity);

node->setPosition(mCamera->getPosition().x - 700, mCamera->getPosition().y + 100 , mCamera->getPosition().z);

node->scale(1,1,1);

OgreNewt::Collision* ent_col = new OgreNewt::CollisionPrimitives::Box( m_World, Ogre::Vector3( 2 , 10 , 2 ) );

OgreNewt::Body* ent_body = new OgreNewt::Body( m_World, ent_col );

Ogre::Vector3 ent_inertia = OgreNewt::MomentOfInertia::CalcBoxSolid( 10, Ogre::Vector3( 2 , 10 , 2) );

ent_body->setMassMatrix( 10 , ent_inertia );

ent_body->attachToNode( node );

ent_body->setPositionOrientation( Vector3(node->getPosition().x,node->getPosition().y+500,node->getPosition().z) , node->getOrientation() );

//mWindow->setDebugText(ent_body->getOgreNode()->getAttachedObject(0)->getName());

/*Ogre::Vector3 Up_Direction_1( 0 , 1 , 0 );

OgreNewt::BasicJoints::UpVector* Up_Vector_1;

Up_Vector_1 = new OgreNewt::BasicJoints::UpVector( m_World, ent_body, Up_Direction_1 );

Ogre::Vector3 Up_Direction_2 ( 1 , 0 , 0 );

OgreNewt::BasicJoints::UpVector* Up_Vector_2;

Up_Vector_2 = new OgreNewt::BasicJoints::UpVector( m_World, ent_body, Up_Direction_2 );*/

ent_body->setStandardForceCallback();

//ent_body->setVelocity(Vector3(0 , 30 , 0));

delete ent_col;

}

// The scene manager will be created by the Scene Loader lib
void chooseSceneManager(void) {}
void createCamera(void) {}
void createViewports(void) {}

// Create new frame listener
void createFrameListener(void)
{
mFrameListener= new oSceneLibDemoFrameListener(mSceneMgr, mWindow, mCamera);
mRoot->addFrameListener(mFrameListener);

mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mCamera, mSceneMgr, m_World, 60 );
mRoot->addFrameListener(mNewtonListener);
}

private:

Ogre::FrameListener* mNewtonListener;

OgreNewt::World* m_World;

};



Thanks for help.

walaber

04-04-2006 00:22:26

are you calling m_World->update() somewhere in your code?

kintaro

12-04-2006 20:56:00

Hi, I tried to put m_World->update(60) in my code, but nothing happens, and when I call OgreNewt::BasicFrameListener the m_World->update(60) is implicit:

mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mCamera, mSceneMgr, m_World, 60 );

Below there is the full code:


#include "ExampleApplication.h"

// oScene loader library header file
#include "OgreOSMScene.h"

#include <OgreNewt.h>

// Callback handler to post-process created objects
class oSceneCallback : public OSMSceneCallbacks {
public:

// We override the OnCreate method for cameras (See IXMLSceneCallbacks class)
void OnCameraCreate(Ogre::Camera* pCamera, TiXmlElement* pCameraDesc) {

// If a camera of name "FirstCamera" is loaded, it will be set as the default current
if(pCamera->getName() == "FirstCamera")
Ogre::Root::getSingleton().getAutoCreatedWindow()->getViewport(0)->setCamera(pCamera);
}

};


// Event handler to animate
class oSceneLibDemoFrameListener : public ExampleFrameListener
{
protected:

SceneManager* mSceneMgr;

OgreNewt::World* m_World;

public:
oSceneLibDemoFrameListener(SceneManager* sceneMgr, RenderWindow* win, Camera* cam, OgreNewt::World* world)
: mSceneMgr(sceneMgr), ExampleFrameListener(win, cam)
{
m_World = world;
}


bool frameStarted(const FrameEvent& evt)
{

static Real timeDelay = 0;
static Real currentTime = 0;

timeDelay -= evt.timeSinceLastFrame;

m_World->update(60);

// We can cycle cameras with the 'c' key
if (mInputDevice->isKeyDown(KC_C) && timeDelay <= 0) {

Camera* firstCam;
Camera* currentCam = mWindow->getViewport(0)->getCamera();

Viewport* vp = mWindow->getViewport(0);

SceneManager::CameraIterator it = mSceneMgr->getCameraIterator();

if(it.hasMoreElements())
firstCam = it.peekNextValue();

while(it.hasMoreElements()) {

Ogre::Camera* cam = it.getNext();

if(currentCam == cam) {
Ogre::Camera* camera = it.hasMoreElements() ? it.getNext() : firstCam;
vp->setCamera(camera);
}
}

timeDelay = 0.5f;

}

// We update all loaded animations each frame
SceneManager::AnimationIterator animationIt = mSceneMgr->getAnimationIterator();

while(animationIt.hasMoreElements()) {
Animation* animation = animationIt.getNext();

const Animation::TrackList& trackList = animation->_getTrackList();

Animation::TrackList::const_iterator it = trackList.begin();
Animation::TrackList::const_iterator iend = trackList.end();

for(; it != iend; ++it) {
const Ogre::AnimationTrack* track = it->second;
track->getAssociatedNode()->resetToInitialState();
}

currentTime += evt.timeSinceLastFrame;
animation->apply(currentTime);
}

// Call default
return ExampleFrameListener::frameStarted(evt);

}
};

class oSceneLibApplication : public ExampleApplication {
public:

oSceneLibApplication()
{
m_World = new OgreNewt::World();
}

~oSceneLibApplication()
{
// destroy world.
delete m_World;
}

protected:

Ogre::FrameListener* mNewtonListener;

OgreNewt::World* m_World;

// Just override the mandatory create scene method
void createScene(void)
{
// Here is the code that will load the scene file
// A fixed filename "scene.osm" is implemented for this demo

// Create the scene loader
OSMScene oScene;

// Create an oE_Loader Callback object to post-process created objects
oSceneCallback oe_Callback;

// Initialises with the scene to be loaded and the callback if requiered
oScene.initialise("simple.osm", &oe_Callback);

// create and setup the scene in the root node
oScene.createScene();


mSceneMgr = oScene.getSceneManager();

mCamera = oScene.getCameraList().at(0);

mCamera->setNearClipDistance(5);

// Create one viewport, entire window
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));

// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(
Real(vp->getActualWidth()) / Real(vp->getActualHeight()));

//create ninja entity
Entity* mEntity;

mEntity = mSceneMgr->createEntity( "Ninja", "ninja.mesh" );

SceneNode* node;

node = mSceneMgr->getRootSceneNode()->createChildSceneNode();

node->attachObject(mEntity);

node->setPosition(mCamera->getPosition().x - 700, mCamera->getPosition().y + 100 , mCamera->getPosition().z);

node->scale(1,1,1);

OgreNewt::Collision* ent_col = new OgreNewt::CollisionPrimitives::Box( m_World, Ogre::Vector3( 20 , 100 , 20 ) );

OgreNewt::Body* ent_body = new OgreNewt::Body( m_World, ent_col );

Ogre::Vector3 ent_inertia = OgreNewt::MomentOfInertia::CalcBoxSolid( 10, Ogre::Vector3( 20 , 100 , 20) );

ent_body->setMassMatrix( 10 , ent_inertia );

ent_body->attachToNode( node );

ent_body->setPositionOrientation( Vector3(node->getPosition().x,node->getPosition().y+500,node->getPosition().z) , node->getOrientation() );

//mWindow->setDebugText(ent_body->getOgreNode()->getAttachedObject(0)->getName());

/*Ogre::Vector3 Up_Direction_1( 0 , 1 , 0 );

OgreNewt::BasicJoints::UpVector* Up_Vector_1;

Up_Vector_1 = new OgreNewt::BasicJoints::UpVector( m_World, ent_body, Up_Direction_1 );

Ogre::Vector3 Up_Direction_2 ( 1 , 0 , 0 );

OgreNewt::BasicJoints::UpVector* Up_Vector_2;

Up_Vector_2 = new OgreNewt::BasicJoints::UpVector( m_World, ent_body, Up_Direction_2 );*/

ent_body->setStandardForceCallback();

//ent_body->setVelocity(Vector3(0 , 30 , 0));

delete ent_col;

}

// The scene manager will be created by the Scene Loader lib
void chooseSceneManager(void) {}
void createCamera(void) {}
void createViewports(void) {}

// Create new frame listener
void createFrameListener(void)
{
mFrameListener= new oSceneLibDemoFrameListener(mSceneMgr, mWindow, mCamera, m_World);
mRoot->addFrameListener(mFrameListener);

mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mCamera, mSceneMgr, m_World, 60 );
mRoot->addFrameListener(mNewtonListener);
}

};




Thanks for help.

kintaro

17-04-2006 21:19:46

It worked!!! Well, after many tries, finally it worked. The main modification in my code it was that I moved:

OgreNewt::BasicFrameListener* mNewtonListener;

mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mCamera, mSceneMgr, m_World, 60 );
mRoot->addFrameListener(mNewtonListener);



To inside createscene function. Well, I don't know yet exactly why it was not working before.

Thanks

Here is the final code:

#include "ExampleApplication.h"

// oScene loader library header file
#include "OgreOSMScene.h"

#include <OgreNewt.h>

// Callback handler to post-process created objects
class oSceneCallback : public OSMSceneCallbacks {
public:

// We override the OnCreate method for cameras (See IXMLSceneCallbacks class)
void OnCameraCreate(Ogre::Camera* pCamera, TiXmlElement* pCameraDesc) {

// If a camera of name "FirstCamera" is loaded, it will be set as the default current
if(pCamera->getName() == "FirstCamera")
Ogre::Root::getSingleton().getAutoCreatedWindow()->getViewport(0)->setCamera(pCamera);
}

};


// Event handler to animate
class oSceneLibDemoFrameListener : public ExampleFrameListener
{
protected:

SceneManager* mSceneMgr;

public:
oSceneLibDemoFrameListener(SceneManager* sceneMgr, RenderWindow* win, Camera* cam)
: mSceneMgr(sceneMgr), ExampleFrameListener(win, cam)
{
}


bool frameStarted(const FrameEvent& evt)
{

static Real timeDelay = 0;
static Real currentTime = 0;

timeDelay -= evt.timeSinceLastFrame;

// We can cycle cameras with the 'c' key
if (mInputDevice->isKeyDown(KC_C) && timeDelay <= 0) {

Camera* firstCam;
Camera* currentCam = mWindow->getViewport(0)->getCamera();

Viewport* vp = mWindow->getViewport(0);

SceneManager::CameraIterator it = mSceneMgr->getCameraIterator();

if(it.hasMoreElements())
firstCam = it.peekNextValue();

while(it.hasMoreElements()) {

Ogre::Camera* cam = it.getNext();

if(currentCam == cam) {
Ogre::Camera* camera = it.hasMoreElements() ? it.getNext() : firstCam;
vp->setCamera(camera);
}
}

timeDelay = 0.5f;

}

// We update all loaded animations each frame
SceneManager::AnimationIterator animationIt = mSceneMgr->getAnimationIterator();

while(animationIt.hasMoreElements()) {
Animation* animation = animationIt.getNext();

const Animation::TrackList& trackList = animation->_getTrackList();

Animation::TrackList::const_iterator it = trackList.begin();
Animation::TrackList::const_iterator iend = trackList.end();

for(; it != iend; ++it) {
const Ogre::AnimationTrack* track = it->second;
track->getAssociatedNode()->resetToInitialState();
}

currentTime += evt.timeSinceLastFrame;
animation->apply(currentTime);
}

// Call default
return ExampleFrameListener::frameStarted(evt);

}
};

class oSceneLibApplication : public ExampleApplication {
public:

oSceneLibApplication()
{}



protected:

OgreNewt::World* m_World;

// Just override the mandatory create scene method
void createScene(void)
{
// Here is the code that will load the scene file
// A fixed filename "scene.osm" is implemented for this demo

// create OgreNewt world.
m_World = new OgreNewt::World();

// Create the scene loader
OSMScene oScene;

// Create an oE_Loader Callback object to post-process created objects
oSceneCallback oe_Callback;

// Initialises with the scene to be loaded and the callback if requiered
oScene.initialise("C:\\Programming\\Ogre\\ogreaddons\\oSceneLoader_demo\\Media\\simple.osm", &oe_Callback);

// create and setup the scene in the root node
oScene.createScene();

mSceneMgr = oScene.getSceneManager();

mCamera = oScene.getCameraList().at(0);

/*// Create a default camera in case no cameras were saved in the scene
mCamera = mSceneMgr->createCamera("PlayerCam");
// Position it at 500 in Z direction
mCamera->setPosition(Vector3(0,0,500));
// Look back along -Z
mCamera->lookAt(Vector3(0,0,-300));
mCamera->setNearClipDistance(5);*/

// Create one viewport, entire window
Viewport* vp = mWindow->addViewport(mCamera);
vp->setBackgroundColour(ColourValue(0,0,0));

// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(
Real(vp->getActualWidth()) / Real(vp->getActualHeight()));

//create a ninja for phisics
Entity* mEntity;

mEntity = mSceneMgr->createEntity( "Ninja", "ninja.mesh" );

SceneNode* mEntity_node;

mEntity_node = mSceneMgr->getRootSceneNode()->createChildSceneNode();

mEntity_node->attachObject(mEntity);

mEntity_node->translate(0,3000,0);

mEntity_node->scale(2,2,2);

//create phisics
OgreNewt::Collision* mEntity_col = new OgreNewt::CollisionPrimitives::Box( m_World, Ogre::Vector3( 100 , 700 , 100 ) );

OgreNewt::Body* mEntity_body = new OgreNewt::Body( m_World, mEntity_col );

Ogre::Vector3 mEntity_inertia = OgreNewt::MomentOfInertia::CalcBoxSolid( 10, Ogre::Vector3( 20 , 100 , 20) );

mEntity_body->setMassMatrix( 10 , mEntity_inertia );

mEntity_body->attachToNode( mEntity_node );

OgreNewt::BasicFrameListener* mNewtonListener;

mNewtonListener = new OgreNewt::BasicFrameListener( mWindow, mCamera, mSceneMgr, m_World, 60 );
mRoot->addFrameListener(mNewtonListener);

mEntity_body->setStandardForceCallback();

}

// The scene manager will be created by the Scene Loader lib
void chooseSceneManager(void) {}
void createCamera(void) {}
void createViewports(void) {}


// Create new frame listener
void createFrameListener(void)
{
mFrameListener= new oSceneLibDemoFrameListener(mSceneMgr, mWindow, mCamera);
mRoot->addFrameListener(mFrameListener);
}

};