Cube-on-space app crashes

AWHDRi

11-07-2009 09:37:52

Hi, i have a problem with a simple app i wrote. Tutorial 5 works fine for me and i
pasted the framelistener code to my project , because i need only space shooting feature without kinematics. So, my app crashes when i press space button.
Debugger show this next entry location
// Matrix's are faster than vectors and quaternions.
Ogre::Matrix4 m4 = toMatrix44(getGlobalPose());

And there is crash log
The thread 'Win32 Thread' (0xa10) has exited with code 0 (0x0).
Unhandled exception at 0x0039fe55 (NxOgre.dll) in dmbapp.exe: 0xC0000005: Access violation reading location 0x00000000.
First-chance exception at 0x0039fe55 (NxOgre.dll) in dmbapp.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x0039fe55 (NxOgre.dll) in dmbapp.exe: 0xC0000005: Access violation reading location 0x00000000.
The program '[2260] dmbapp.exe: Native' has exited with code 0 (0x0).

This application loads an ogitor's single mesh scene with attached triangle-nxs static geometry.
My framelistener
class TerrainFrameListener : public ExampleFrameListener
{
public:
TerrainFrameListener(RenderWindow* win, Camera* cam, NxOgre::VisualDebugger* visualDebugger, Ogre::SceneNode* node)
: ExampleFrameListener(win, cam)
{
// Reduce move speed
mMoveSpeed = 50;

mTimeController = NxOgre::TimeController::getSingleton();
mVisualDebugger = visualDebugger;
mVisualDebuggerNode = node;
}

bool frameStarted(const FrameEvent& evt)
{
mTimeController->advance(evt.timeSinceLastFrame);
mVisualDebugger->draw();
mVisualDebuggerNode->needUpdate();
//Стрелять на пробел
if(mKeyboard->isKeyDown(OIS::KC_SPACE) && mTimeUntilNextToggle <= 0)
{
LogManager::getSingletonPtr()->logMessage("*** SPACE DOWN ***");
mCubeSpace = mRenderSystem->createBody(new NxOgre::Box(1, 1, 1), NxOgre::Real3(mCamera->getPosition().x,
mCamera->getPosition().y, mCamera->getPosition().z), "cube.1m.mesh");
LogManager::getSingletonPtr()->logMessage("*** CUBE OK***");
mCubeSpace->addForce(NxOgre::Real3(mCamera->getDirection().x * 10000, mCamera->getDirection().y * 10000,
mCamera->getDirection().z * 10000), NxOgre::Enums::ForceMode_Force, true);
LogManager::getSingletonPtr()->logMessage("*** FORCE OK ***");
mTimeUntilNextToggle = 0.2;
}

return ExampleFrameListener::frameStarted(evt);
}

bool frameRenderingQueued(const FrameEvent& evt)
{
if( ExampleFrameListener::frameRenderingQueued(evt) == false )
return false;

// clamp to terrain

return true;

}
protected:
NxOgre::TimeController* mTimeController;
NxOgre::VisualDebugger* mVisualDebugger;
Ogre::SceneNode* mVisualDebuggerNode;
OGRE3DRenderSystem* mRenderSystem;

OGRE3DBody* mCubeSpace;


};

Static geometry loading
//StaticNxgeom
NxOgre::ResourceSystem::getSingleton()->openArchive("content", "file:content/stage/stg1");
NxOgre::Mesh* triangleMesh = NxOgre::MeshManager::getSingleton()->load("content:Mesh02.mesh.nxs");
NxOgre::TriangleGeometry* triangleGeometry = new NxOgre::TriangleGeometry(triangleMesh);
mScene->createSceneGeometry(triangleGeometry, NxOgre::Matrix44(NxOgre::Real3(0, 0, 0)));

Whats the problem? And why visual debugger not works on BloodyMess 1.5.5?
And sorry for my terrible english)

betajaen

11-07-2009 10:52:40

The class that this belongs to "getGlobalPose()" (which I expect is Body) is a null pointer meaning it hasn't been created, or you haven't copied the pointer properly.

AWHDRi

15-07-2009 21:27:02

Thanks, i fixed that. But I have new problem - When I shoot cubes, some of them may
fall through the geometry of the scene. It doesn't depend of the location (i can move camera and shoot again in the same place and they are no longer falls). How can I fix this? And how to define additional parameters for an object (weight, etc)?

spacegaier

15-07-2009 21:40:14

Perhaps your cubes are too fast, so that the collision can't be detected without CCD (ContinousCollisionDetection). Not sure though whether this feature is already implemented in BloodyMess, but I guess not.

You could just lower the speed of your cubes for testing purpose to see if they still pass through your plane then.

betajaen

15-07-2009 22:33:30

I'm not sure with your wording if it's a plane or heightfield your having trouble with;

- Planes; The Plane X,Z size is infinite, and it's thickness is half of infinity. There is no way you could have any problems with collisions with them.

- Heightfields; if it did initially fall through the heightfield "skin", it would still be tunneling through several metres of heightfield. Unless your going incredibly fast with those cubes; PhysX will catch the collision and force it out. Try increasing the vertical extent or thickness.

AWHDRi

16-07-2009 12:00:14

Сould it be because of the size of the scene (single .mesh + single triangle .nxs) ?

betajaen

16-07-2009 12:23:58

It may. First though; try sub-dividing the triangles; so there are more of them.

Also; If that is a ping-pong table, and your doing a table-tennis game; there are much better ways of handling collisions that one giant triangle mesh.

AWHDRi

18-07-2009 17:47:50

How can I scale the scene to make it responds to the NxOgre coordinate system and 1m cube? Can you give me the source of cube.1m.mesh?

betajaen

18-07-2009 18:21:32

NxOgre uses the 1 unit = 1 metre system, and a 1 metre cube isn't difficult to create.

AWHDRi

27-07-2009 14:27:47

Sorry for asking so many stupid questions, but now i'm stuck on Volumes. I can't understand how create multiple callbacks for volumes. Can anyone post a sample code like here http://www.ogre3d.org/wiki/index.php/Bl ... Tutorial_4 but with couple of volumes with callbacks

spacegaier

27-07-2009 16:40:02

You can only assign one callback class to each volume.

What do you want to achieve?

betajaen

27-07-2009 16:41:18

If you want multiple callbacks, then your single callback will have to call many itself. Your callback could iterate through a array of function pointers, or if you want a bit more fancy boost functions and a vector.