[solved] the program craches after body creatio

maroxe

27-08-2008 23:41:46

Hi,
i have a strange probleme with blending, here is a minimal code:
PhysXParams p;
p.mUseLog = true;
p.mTimeController = PhysXParams::TC_OGRE;
World* mWorld = new World(p);
Scene* mScene = mWorld->createScene("myFirstScene", "gravity: yes, floor: yes");
NxOgre::Body* mBody = mScene->createBody("myBody", new Cube(2,2,2), NxOgre::Pose(NxVec3(0, 0, 0)), "model: robot.1m.mesh, scale: 2 2 2", "mass: 10");


the debugger return that:
> Ogre.exe!NxOgre::RenderableSource::render_Absolute(const NxOgre::TimeStep & ts={...}) Ligne 101 + 0x3 octets C++
Ogre.exe!NxOgre::SceneRenderer::render(const NxOgre::TimeStep & ts={...}) Ligne 53 + 0x25 octets C++
Ogre.exe!NxOgre::Scene::render() Ligne 1456 C++
Ogre.exe!NxOgre::World::render(float time=0.0040000002) Ligne 182 + 0x5 octets C++
Ogre.exe!NxOgre::PhysXDriver::render(float time=0.0040000002) Ligne 596 C++
Ogre.exe!NxOgre::OgreTimeController::frameEnded(const Ogre::FrameEvent & evt={...}) Ligne 50 C++
OgreMain.dll!1012ed72()
[Les frames ci-dessous sont peut-être incorrects et/ou manquants, aucun symbole chargé pour OgreMain.dll]
OgreMain.dll!101305e8()
OgreMain.dll!1013081e()
Ogre.exe!CApp::go() Ligne 15 C++
Ogre.exe!WinMain(HINSTANCE__ * hInst=0x00400000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x00151efb, HINSTANCE__ * __formal=0x00000000) Ligne 34 C++
Ogre.exe!__tmainCRTStartup() Ligne 574 + 0x1d octets C
kernel32.dll!7c816fd7()

the problem is from the variable mRenderPose, but i don't know why :(

Prophet

28-08-2008 10:59:35

Try setting the PhysXParams to default by using setToDefault(). String params also works with the world, so you can skip that and just go World* mWorld = new World("log: yes, time-controller: ogre");
Scene* mScene = mWorld->createScene("myFirstScene", "gravity: yes, floor: yes");
NxOgre::Body* mBody = mScene->createBody("myBody", new Cube(2,2,2), NxOgre::Pose(NxVec3(0, 0, 0)), "model: robot.1m.mesh, scale: 2 2 2", "mass: 10");

Hope that helped!

Rasengan

28-08-2008 11:59:53

Don't forget to set the scene renderer.

http://www.ogre3d.org/phpBB2addons/view ... body+crash

:)


NxOgre::SceneParams sceneParams;
sceneParams.setToDefault();
sceneParams.mRenderer = NxOgre::SceneParams::RN_OGRE;
...
...
mScene = mWorld->createScene("YourLoveScene", sceneParams);

maroxe

28-08-2008 12:05:44

same problem :(

maroxe

28-08-2008 12:18:41

PS: i am using "PhysX_2.8.1_SDK_Core.msi" and "PhysX_8.04.25_SystemSoftware.exe"

Prophet

28-08-2008 12:30:30

I'm not sure, but shouldn't you use 8.06.12 instead of 8.04.25?

maroxe

28-08-2008 12:41:06

i don't think the problem is from Phyx, but it's probably caused by the Renderable class, wich has nothing to do with Phyx!

Prophet

28-08-2008 12:46:33

If you use createActor instead of createBody and then every frame set a SceneNode's (with attached entity) position and rotation to the actors, does that work? I never got Body to work... :oops:

betajaen

28-08-2008 13:35:35

Try simplifying the code a little:

World* mWorld = new World("log: yes, time-controller: ogre");

Scene* mScene = mWorld->createScene("myFirstScene", "gravity: yes, floor: yes, renderer: ogre");

NxOgre::Body* mBody = mScene->createBody("robot.1m.mesh;Robot", new Cube(2,2,2), NxOgre::Pose(NxVec3(0, 4, 0)), "mass: 10");




@prophet I really can't see how you can't get the Body/RenderableSource working, it's almost fool proof.

Prophet

28-08-2008 13:55:07

I guess I'm too high-tech for it. Nah, me neither. Haven't give it a try in a while though, perhaps I will. If so, I might find the answer to this mystery.

mcaden

28-08-2008 14:14:09

Sounds to me like it can't find your mesh.

maroxe

28-08-2008 14:27:59

Sounds to me like it can't find your mesh.
if it can't find it, an exception will be thrown ;)
@betajeen:
with your code, i get the exception:
5:25:12: OGRE EXCEPTION(5:ItemIdentityException): Unable to derive resource group for Robot automatically since the resource was not found. in ResourceGroupManager::findGroupContainingResource at ..\src\OgreResourceGroupManager.cpp (line 1368)
that's strange because if i create a simple entity like that:
SceneManager->CreateEntity("Robot", "robot.mesh");

, i don't get any error :o

betajaen

28-08-2008 14:59:35

"robot.1m.mesh" != "robot.mesh"

maroxe

28-08-2008 15:07:48

hein?
i thaugth that robot.1m.mesh is a scaled robot.mesh, maybe i am wrong
but the following code doesn't work too:

NxOgre::Body* mBody = mScene->createBody("robot.mesh;Robot", new Cube(2,2,2), NxOgre::Pose(NxVec3(0, 4, 0)), "mass: 10");

what's th eproblem, doc?

mcaden

28-08-2008 16:38:47

ogre.log show any errors?

maroxe

28-08-2008 17:18:15

this the only error:18:10:58: OGRE EXCEPTION(5:ItemIdentityException): Unable to derive resource group for Robot automatically since the resource was not found. in ResourceGroupManager::findGroupContainingResource at ..\src\OgreResourceGroupManager.cpp (line 1368)
this the project for visual C++: http://www.mediafire.com/?sharekey=8923c11318d65741d2db6fb9a8902bda

mcaden

28-08-2008 17:53:55

That's Ogre telling you the mesh doesn't exist.

So the mesh is either in the wrong place, or the path is wrong in resources.cfg.

Try it, type in "betajaen.mesh" instead of robot.mesh...you'll get the same exact error.

maroxe

28-08-2008 18:38:14

like i said: SceneMgr->createEnity("entity", "robot.mesh");//works
Scene->CreateBody("robot.mesh;robot"; ...);//does't work

betajaen

28-08-2008 19:05:47

Try:

mScene->createBody("Charlie;robot.mesh", ...);

maroxe

29-08-2008 00:05:08

thanks, it works :D

maroxe

29-08-2008 11:19:03

now i have a newsimilar problem, this code crashes:
new Convex("robot.mesh");

betajaen

29-08-2008 11:40:39

Convert it to an nxs using flour.

maroxe

29-08-2008 11:48:57

sorry, i don't uderstand well what you mean :shock: , with previous version, this command works perfectly

betajaen

29-08-2008 11:52:47

I'm pretty sure you'll have to convex the mesh using flour in the previous SVN version. PhysX can't read Ogre meshes; which for a few reasons not suitable for collision data anyway - so you have to convert it using flour and use the following to address it:

new Convex("file://robot.nxs");


Why are you using '20 again?

maroxe

29-08-2008 12:03:10

ok thanks a lot for your precious help.Why are you using '20 again?i am bad at english, what does this sentence mean?

mcaden

29-08-2008 12:36:46

convert the .mesh file into a .nxs file for NxOgre to use for collision

-> http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=6900

ok thanks a lot for your precious help.

Why are you using '20 again?

i am bad at english, what does this sentence mean?

He means you're not using the newest version of NxOgre.

Although I just noticed my NxOgre.html file says I'm using '20, even though SVN says I'm using '21.

maroxe

29-08-2008 13:16:10

Why are you using '20 again?i updated my svn yesterday, so my version should be the newest, no?
even with the flour mehod, the same problem: it crashes at createShape mehod. ( i tried o convert sevral meshes)

reptor

29-08-2008 22:41:53

Yeah, the NxOgre log file gets the "1.0.20" version into it, even though elsewhere it is "1.0.21".

That might be confusing.

From NxOgreStable.h:

/** \file NxOgreStable.h
* \brief NxOgre pre-compiled header and common headers include used by
* all NxOgre source (cpp) files with no exceptions.
* \version 1.0-21

<snip>

#define Nx_Version_Major 1
#define Nx_Version_Minor 0
#define Nx_Version_Commit 21
#define Nx_Version_Codename "Bleeding Edge"

#if (NX_DEBUG == 0)
# define Nx_Version_Full "NxOgre 1.0.20 Bleeding Edge"
#else
# define Nx_Version_Full "NxOgre 1.0.20 Bleeding Edge (Debug)"
#endif



There is some inconsistency.

maroxe

29-08-2008 23:28:51

francly, i don't care it's 20 or 21 version, what matter for me is to get nxogre work properly :D
do you have the same problem whe building convex mesh?

betajaen

30-08-2008 07:18:50

Calm down.

Now you have a problem with cooking or loading the mesh? I presume "robot.mesh" is the animated robot that comes with Ogre; how about you try a more simple mesh - that not animated, and is actually convex in shape.

maroxe

30-08-2008 12:59:55

it's the loading of nxs file who causes problems, it crashes at exactly createShape mehod.
i have tried a lot of meshes(a cube, a sphere, and others) but o one worked :(

mcaden

30-08-2008 14:14:32

Oops! Sorry, you have to load the .nxs file into NxOgre's resource system. It's separate from Ogre's.


NxOgre::Resources::ResourceSystem::getSingleton()->addMesh("file://robot.nxs");
NxOgre::Body* mBody = mScene->createBody("Robot;robot.mesh", new Convex(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "robot.nxs")), NxOgre::Pose(NxVec3(0, 4, 0)), "mass: 10");


EDIT:

That *should* do it I believe. I haven't used convex meshes. I've only used triangle meshes (for terrain), and cubes for everything else. I'm making some rocks soon that my character is supposed to be able to roll, and they'll be odd shapes so I'll be making convex collision meshes soon (of course I'll make a specific collision mesh for it with a LOT less pixels than my actual rock).

EDIT2: file:\\robot.nxs states that the file is in the same directory as the .exe. steer that path to the subfolder the .nxs file is actually in.

maroxe

30-08-2008 14:49:46

ah ok, i didn't know that, thanks.
i will try it

maroxe

30-08-2008 17:47:25

it crashes also with your method at the same place :(

mcaden

30-08-2008 19:09:56

oh yeah, did you do the mesh fix?


haha~~ Guess What? I've found the root cause of this annoying bug!
Now here is my fix.
At the bottom of the method in NxOgreMesh.cpp :

void Mesh::MeshData::zero() {
mTriangleMesh = 0;
mConvexMesh = 0;
mSkeletonMesh = 0;
mClothMesh = 0;
mSoftBodyMesh = 0;
mType = MT_Unknown;
mNbReferences = 0;
}

Append this line:

mMaterialAlias = 0;


Because isZero() method checks the variable mMaterialAlias whether it's initialized.


bool Mesh::MeshData::isZero() const {
return (mTriangleMesh == 0 && mConvexMesh == 0 && mSkeletonMesh == 0 && mClothMesh == 0 && mSoftBodyMesh == 0 && mMaterialAlias == 0);
}


Besides, it's necessary to add mMesh.zero() before loading in the constructor:

Mesh::Mesh(const ResourceIdentifier& ri) {
mMesh.zero();
load(ri);
}

/////////////////////////////////////////////////////////////

Mesh::Mesh(Resource* rs) {
mMesh.zero();
load(rs);
}


So that I can use converted files from Flour now. Cheers!

maroxe

30-08-2008 21:27:36

same problem:
PhysXCore.dll!0af10caf()
[Les frames ci-dessous sont peut-être incorrects et/ou manquants, aucun symbole chargé pour PhysXCore.dll]
PhysXCore.dll!0afa58b5()
PhysXCore.dll!0ae2b9d0()
PhysXCore.dll!0af12bfe()
PhysXCore.dll!0af29f07()
PhysXCore.dll!0af53a23()
msvcr90.dll!78583a58()
msvcr90.dll!78583a58()
> Ogre.exe!NxOgre::Convex::createShape(NxArray<NxShapeDesc *,NxAllocatorDefault> & shapes={...}, unsigned int index=2019084617, NxOgre::Scene * scene=0x00b05a10) Ligne 101 + 0x3c octets C++
Ogre.exe!NxOgre::Actor::_createActor(NxOgre::Shape * shape=0x00000000, const NxOgre::Pose & pose={...}, NxOgre::ActorParams params={...}) Ligne 313 + 0x15 octets C++
msvcp90.dll!78484f2a()
msvcp90.dll!78484f2a()
msvcp90.dll!784851d5()
msvcp90.dll!78485968()
msvcp90.dll!7848633d()
msvcp90.dll!7848723d()
msvcp90.dll!78485c80()
msvcr90.dll!785838bb()
msvcr90.dll!78583a58()
OgreMain.dll!10127ae5()
OgreMain.dll!10127cc7()
Ogre.exe!__tmainCRTStartup() Ligne 574 + 0x1d octets C
kernel32.dll!7c816fd7()

mcaden

31-08-2008 05:20:38

can you e-mail me the .nxs file?


mcaden AT gmail.com

maroxe

31-08-2008 14:05:37

message sent(my email is bachir009 at gmail dot com )

mcaden

31-08-2008 15:05:38

Here's your mesh in action:


Here's the code:
NxOgre::Resources::ResourceSystem::getSingleton()->addMesh("file://ActivatedBoxA.nxs");
NxOgre::Body* mBody = mScene->createBody("Robot;ActivatedBoxA.mesh", new Convex(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "ActivatedBoxA.nxs")), NxOgre::Pose(NxVec3(0, 4, 0)), "mass: 10");


I had the .mesh where ogre could find it through resources.cfg, and I had the .nxs file in the same directory as the .exe.

If you can't load it with that setup, I'd say you either didn't correctly apply the fix (did you change the NxOgre code, rebuild it, and replace the DLLS?), or I'm forgetting another fix...I'm pretty sure you either had it in the wrong directory, or didn't correctly apply the fix I posted.

I think the fix along with several others will make it into SVN soon...up to betajaen though.

maroxe

31-08-2008 15:43:28

i don't know how to thnak you :D

i will try it as soon as i can. but this not the mesh i gave you :P

mcaden

31-08-2008 16:22:16

My character is standing on/colliding with the mesh you sent me. A rectangular box.

You didn't send me a texture or .material file so it's just plain gray.

maroxe

31-08-2008 16:36:01

you're right, but the character looks awsome, ould you pass it to me?

mcaden

31-08-2008 18:49:21

It's the main character for the game project I'm working on...I might make the assets/code open source...but not for a while.

I don't plan on making things available just yet. ;)

Did you have a question about how I did something for it? It's basically just a UV-mapped and textured mesh with a .material script and an emissive map, with 3 particle emitters attached to various bones (left and right eyes, and the flames along the back).

maroxe

31-08-2008 19:20:07

me too i'm programming a (very) little game just for fun. If i need help, i'll know who to ask ;)

maroxe

31-08-2008 20:16:32

good luck for your project