texturing a body

Grom

19-01-2007 01:42:37

Hey! I'm completely new to nxOgre. I have a basic scene set up with a box created like this:

myBody = mScene->createBody("myCube", "cube.1m.mesh", new cubeShape(1.0f), 10.0f, Vector3(0,10,0) );


My question is... how do I texture the cube? Right now it's a white box with no shading. Is there a way to apply a standard OGRE material to the body? And if I use a mesh that includes texturing information, will that use its own materials automatically as defined by the mesh file?

betajaen

19-01-2007 11:34:54

You'd create your own cube and texture it in your own modeller program.

Grom

19-01-2007 22:57:17

Ok. There isn't a way to texture a body after the fact?

betajaen

19-01-2007 23:05:00

Technically your texturing a entity, a body is a NxActor and a SceneNode with an optional entity.

But the cube.1m.mesh doesn't have an UV coordinates, but yes anyway ;)

Grom

20-01-2007 19:30:56

hmm would I do it through the addEntity function?

and when I model a cube in Max and push it around in the scene it seems to roll up and down on the floor (varying in height) and sometimes it interacts with another cube properly, sometimes it goes through it about halfway... I made the cube 1x1 meters and put it at 0,0,0, which in max centers it about the axis. should it be offset so it's 1 meter in the positive x and 1 meter in the positive y? I tried a lot of combinations of this and they all seem inaccurate...

betajaen

20-01-2007 19:48:41

Sort of, the first entity is created in the createBody(..., "meshName.mesh", .. ) and any additional ones are created by the addEntity.

Sounds like the mesh isn't centered, what does it look like in debug mode?

Grom

20-01-2007 21:51:46

Ah, figured it out. In max when you create a box it puts the local pivot point at the bottom center of the mesh, so even if you move it up and down the pivot point stays the same. I needed to change the local pivot point so that it was in the center of the box, and now it works perfectly. Thanks for the help!