Scaling mesh data for bodies in NxOgre

castles999

28-04-2007 19:50:18

Hi,

I've been using NxOgre for one of my class projects and it has been working really well. I read through many of the tutorials, but there is something I don't know if it is possible to do.

I've been trying to create random creatures represented as a directed graph. Each node is a cube that contains length, width, and height information as well as other orientation data. When I try to join up all of these nodes in 3d with joints, I am having difficulty creating bodies with different sizes. I am currently using the "cube.1m.mesh" file to create my bodies. Since each node contains randomized values for the dimensions of the cube, it is not feasible to create mesh files for each of these nodes and load them up in this manner.

In Ogre, it is possible to scale SceneNodes through the scale method call. I saw that NxOgre has a createBody method that is able to accept instead of a mesh file name, a SceneNode object. However, upon compiling I got a linker error. When I looked up the exact method, I don't think it has been implemented yet as I am using version 0.4 RC3.

Is it possible to scale a body's geometry upon the creation or with a seperate method call?

Let me know if there is any way this can be done in NxOgre.

Thanks

betajaen

28-04-2007 19:57:08

Of course, but you do it in a slighty different process:

float w = random_number();
float h = random_number();
float d = random_number();

body* mBody = mScene->createBody("myCube", "cube.1m.mesh", new cubeShape(Vector3(w,h,d)), 10.0f, Vector3(0,10,0));
mBody->mNode->scale(w,h,d);


The "random_number()" is your random number generator code, but apart from that it's pretty easy.

castles999

30-04-2007 00:04:44

Thanks for the help. I guess I didn't know you could access the SceneNode of the body I just created.