findBody() crashes

ocrim74

29-11-2006 00:45:25

Hi,

I have got the problem that my findBody()-method crashes. I checked out the latest nxOgre-files from the CVS-repository and compiled it.

There are two overloads shown in the VS2005. Is there anything wrong in my code?

mScene->createBody(
"ladderOuter", // Name
"ladder-outer.mesh", // Mesh to use
new nxOgre::cubeShape(Vector3(7.1f,0.6f,1.6f)), // Collision Model to use
10.0f, // Density of the body (In Kilograms)
Vector3(0,3.38f,0) // Where to put it. (In Metres)
);
mScene->findBody("ladderOuter")->mEntity->setCastShadows( true );


If I comment out the last row it works.

Do you have an idea whats going wrong?

Thank you!

ocrim74

betajaen

29-11-2006 09:25:44

Well the CVS, is over 6 months old (and I thought I turned it off). You should download 0.4 RC2 which is the latest.

Also, this way is better:

body *ladderOuter = mScene->createBody(....);
ladderOuter->mEntity->setCastShadows(true);

ocrim74

29-11-2006 12:21:26

Hi,

thank you for the information. I tried the 0.4 RC2 and it works!

I use your code directly after creating the body. But if I hit a key I am now able to access the object in the FrameListener-class by using the findBody()-method.

That was very helpful!

ocrim74

betajaen

29-11-2006 12:25:42

Excellent! ;)