BloodyMess Tutorial 7 Problem

asvsfs

20-08-2009 20:52:14

hi,
i just copied Tutorial 7 and change the file name and tried to compile but it crash on this line:
OGRE3DBody* convexBody = mRenderSystem->createBody(convex, NxOgre::Real3(0, 30, 0), "Barrel.mesh");

--------------------------------------------------
// Open archive and load the meshes
NxOgre::ResourceSystem::getSingleton()->openArchive("media", "file:C:\OgreSDK\bin\debug\Media");
NxOgre::Mesh* convexMesh = NxOgre::MeshManager::getSingleton()->load("media:Barrel.nxs");
NxOgre::Mesh* triangleMesh = NxOgre::MeshManager::getSingleton()->load("media:Cone.nxs");

// Create the Convex and the TriangleGeometry
NxOgre::Convex* convex = new NxOgre::Convex(convexMesh);
NxOgre::TriangleGeometry* triangleGeometry = new NxOgre::TriangleGeometry(triangleMesh);

// Create the OGRE3DBody with the Convex as its shape
OGRE3DBody* convexBody = mRenderSystem->createBody(convex, NxOgre::Real3(0, 30, 0), "Barrel.mesh");
convexBody->setGlobalOrientation(NxOgre::Matrix33(NxOgre::Real4(0, 45, 0, 45)));

// Create the SceneGeometry
mScene->createSceneGeometry(triangleGeometry, NxOgre::Matrix44(NxOgre::Real3(0, 5, 0)));

// Create the Entity and Scenenode to visualize the SceneGeometry
Ogre::Entity* triangleEntity = mSceneMgr->createEntity("triangleEntity", "Cone.mesh");
Ogre::SceneNode* triangleNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
triangleNode->attachObject(triangleEntity);
triangleNode->setPosition(Vector3(0, 5, 0));

betajaen

20-08-2009 21:00:04

Can't use ogre meshes directly into NxOgre. You have to convert them using flour.

asvsfs

20-08-2009 21:02:02

ok, then .mesh must be .nxs?
"Barrel.mesh" to barrel.nxs?
:!:
i did that but it wont work!
in Sample there is Barrel.mesh how can i convert it?
i use Flour convert in:barrel.mesh into:convex,out:barre.nxs
i still getting same error access violation on this line -->OGRE3DBody* convexBody = mRenderSystem->createBody(convex, NxOgre::Real3(0, 30, 0), "Barrel.nxs");

mActor = mScene->getScene()->createActor(actor_description);

spacegaier

20-08-2009 22:25:02

If you really used tis line for conversion everything should be fine with the NXS file.
flour convert in:Barrel.mesh, into:convex, out:Barrel.nxs

Just make sure that Barrel.nxs lies in the listed path so your EXE can find it. You could also run your application in debug mode and post the NxOgre.log and the NxOgreLeaks.txt files. Perhaps the problems is listed there.

betajaen

20-08-2009 22:32:20

Just make sure that Barrel.nxs lies in the listed path so your EXE can find it. You could also run your application in debug mode and post the NxOgre.log and the NxOgreLeaks.txt files. Perhaps the problems is listed there.

If your running in Debug Mode. You can perform a stack trace to the exact line that is causing the error.

asvsfs

21-08-2009 06:10:51

this is my NxOgre Log File
:-Error -----------------------------------------------------------
From: f:\scmvista\experimental\PhysX_2.8.1_GPU\novodex\SDKs\Physics\src\NpScene.cpp(862)
PhysX error:
Supplied NxActorDesc is not valid. createActor returns NULL.
NxErroCode:A method called with invalid parameter(s)
------------------------------------------------------------------

NxOgreLeaks.rar
[attachment=0]NxOgreLeaks.rar[/attachment]

Path is right.. media folder is where the exe is. and i use :

NxOgre::ResourceSystem::getSingleton()->openArchive("media", "file:C:\OgreSDK\bin\debug\Media");
or
NxOgre::ResourceSystem::getSingleton()->openArchive("media", "file:media");

asvsfs

21-08-2009 15:25:01

... No Solution?

betajaen

21-08-2009 16:38:56

Your actor description for one of those actors/bodies there is invalid. What does the full log say?

asvsfs

21-08-2009 16:43:20

- Pointer: #070140F8
Type: char
Size: 358 b
Source: f:\fii\nxogre.1.5.5.bloodymess\build\source\nxogresharedstringstream.cpp#247
Partial dump: >
-Error -------------------------
--------------------------------
--.From: f:\scmvista\experimenta
l\PhysX_2.8.1_GPU\novodex\SDKs\P
hysics\src\NpScene.cpp(862).Phys
X error:.Supplied NxActorDesc is
not valid. createActor returns
NULL..NxErroCode:A method called

betajaen

21-08-2009 16:50:44

That's the leaks; The NxOgre log.

I need something more specific than the Description is NULL. There are many reasons why it could be null.

asvsfs

21-08-2009 17:00:45

Here is my code:

#include "ExampleApplication.h"

#include <NxOgre.h>
#include <NxOgreOGRE3D.h>

class BloodyMessTutorial7Listener : public ExampleFrameListener
{
public:
BloodyMessTutorial7Listener(RenderWindow *win, Camera *cam)
: ExampleFrameListener(win, cam)
{
mTimeController = NxOgre::TimeController::getSingleton();
}

bool frameStarted(const FrameEvent& evt)
{
mTimeController->advance(evt.timeSinceLastFrame);
return ExampleFrameListener::frameStarted(evt);
}

protected:
NxOgre::TimeController* mTimeController;
};

class BloodyMessTutorial7 : public ExampleApplication
{
protected:
NxOgre::World* mWorld;
NxOgre::Scene* mScene;
NxOgre::TimeController* mTimeController;
OGRE3DRenderSystem* mRenderSystem;

void createScene()
{
// Set ambient light
mSceneMgr->setAmbientLight(ColourValue(0.5f, 0.5f, 0.5f));

// Create a light
Light* l = mSceneMgr->createLight("MainLight");
l->setPosition(20, 80, 50);

// Position the camera
mCamera->setPosition(0, 20, 80);
mCamera->lookAt(0, 20, 0);

// Create the world
mWorld = NxOgre::World::createWorld();

// Create scene description
NxOgre::SceneDescription sceneDesc;
sceneDesc.mGravity = NxOgre::Real3(0, -9.8f, 0);
sceneDesc.mName = "DemoScene";

// Create scene
mScene = mWorld->createScene(sceneDesc);

// Set some physical scene values
mScene->getMaterial(0)->setStaticFriction(0.5);
mScene->getMaterial(0)->setDynamicFriction(0.5);
mScene->getMaterial(0)->setRestitution(0.1);

// Create render system
mRenderSystem = new OGRE3DRenderSystem(mScene);

//Create time controller
mTimeController = NxOgre::TimeCntroller::getSingleton();

// Create floor plane (BloodyMess)
mScene->createSceneGeometry(new NxOgre::PlaneGeometry(0, NxOgre::Real3(0, 1, 0)), NxOgre::Matrix44(NxOgre::Matrix44::IDENTITY));

// Create floor plane (Ogre)
MovablePlane *plane = new MovablePlane("Plane");
plane->d = 0;
plane->normal = Vector3::UNIT_Y;
Ogre::MeshManager::getSingleton().createPlane("PlaneMesh",
ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
*plane, 120, 120, 1, 1, true, 1, 3, 3, Vector3::UNIT_Z);
Entity *planeEnt = mSceneMgr->createEntity("PlaneEntity", "PlaneMesh");
planeEnt->setMaterialName("PlaneMat");

Ogre::SceneNode* mPlaneNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
mPlaneNode->attachObject(planeEnt);

// Open archive and load the meshes
NxOgre::ResourceSystem::getSingleton()->openArchive("media", "file:C:\OgreSDK\bin\debug\Media");
NxOgre::Mesh* convexMesh = NxOgre::MeshManager::getSingleton()->load("media:Barrel.nxs");
NxOgre::Mesh* triangleMesh = NxOgre::MeshManager::getSingleton()->load("media:Cone.nxs");

// Create the Convex and the TriangleGeometry
NxOgre::Convex* convex = new NxOgre::Convex(convexMesh);
NxOgre::TriangleGeometry* triangleGeometry = new NxOgre::TriangleGeometry(triangleMesh);

// Create the OGRE3DBody with the Convex as its shape
OGRE3DBody* convexBody = mRenderSystem->createBody(convex, NxOgre::Real3(0, 30, 0), "media:Barrel.Mesh");
convexBody->setGlobalOrientation(NxOgre::Matrix33(NxOgre::Real4(0, 45, 0, 45)));

// Create the SceneGeometry
mScene->createSceneGeometry(triangleGeometry, NxOgre::Matrix44(NxOgre::Real3(0, 5, 0)));

// Create the Entity and Scenenode to visualize the SceneGeometry
Ogre::Entity* triangleEntity = mSceneMgr->createEntity("triangleEntity", "Cone.Mesh");
Ogre::SceneNode* triangleNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
triangleNode->attachObject(triangleEntity);
triangleNode->setPosition(Vector3(0, 5, 0));
}

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

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
#else
int main(int argc, char **argv)
#endif
{
// Create application object
BloodyMessTutorial7 app;

try {
app.go();
} catch(Exception& e) {
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
MessageBoxA(NULL, e.getFullDescription().c_str(),
"An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
std::cerr << "An exception has occurred: " << e.getFullDescription();
#endif
}

return 0;
}

#ifdef __cplusplus
}
#endif


my working directory:
C:\OgreSDK\bin\debug

in debug there is media folder that contain Barrel.mesh and Barrel.nxs....
and NxOgre LOg File
-Error -----------------------------------------------------------
From: f:\scmvista\experimental\PhysX_2.8.1_GPU\novodex\SDKs\Physics\src\NpScene.cpp(862)
PhysX error:
Supplied NxActorDesc is not valid. createActor returns NULL.
NxErroCode:A method called with invalid parameter(s)
------------------------------------------------------------------

betajaen

21-08-2009 21:18:17

I appreciate what your putting here. But it is a bit of a needle in a haystack. I need something more specific. How about you start taking blocks of code out until it stops crashing then slowly add bits back in to find the offending line.

asvsfs

22-08-2009 07:14:32

i think i get it ! Barrel.mesh is not Problem.. Trianglemesh is the main problem when i delete codes for Triangle mesh
program run without any error i think My trianglemesh has some problem i will convert my mesh again .



thx for reply

asvsfs

22-08-2009 09:11:52

i made a triangle mesh from Plane.mesh and it worked there must be something wrong with Cone.mesh to be triangle mesh!
WHen visual debugger will Be ready? i really need it everybody needs it.
another question :
i need my trigger move with a NxBody how can i do that? can i simply change its global position ?
Thx

spacegaier

22-08-2009 11:22:01

The VisualDebugger is ready and works (if you grab the version from the Git repo).

I'm not sure, if triggers were designed to be moved, but you could have a try ;) .

why there isn't any document for nxogre itself?
What do you mean by this?

The right Flour conversion line would look like this:
flour convert in:Cone.mesh, into:triangle, out:Cone.nxs

asvsfs

22-08-2009 11:56:32

it worked!

thx for reply

spacegaier

22-08-2009 11:59:13

Dont get the sense out of this sentence...
i was going to change my physic engine to Bullet but i believe NxOgre is best to choose!
...but do as you please.