Scale

vasquez

12-04-2006 15:34:15

Greetings to all,
in advance I apologize for my bad English.

How can i scale the mesh of cube in step with process of scaling of a body in which one the beck is?
I shall be grateful, if you will instance how it can be made.

betajaen

12-04-2006 15:48:05

I'm not sure what you mean by beck but:

NxOgre uses the scale: 1 metre = 1 Ogre unit.

So if you have a cardboard box is 1 metre in size, and you want to SceneNode->scale(10.0f), then the shape would be cubeShape(10.0f).

Hope this helps.

vasquez

13-04-2006 10:19:47

Thank you for help, betajaen,

but when i do something about that:
body* myCube = mScene->createBody(
"myCube",
"cube.1m.mesh",
new cubeShape(1.0f),
10.0f,
Vector3(0, 0, 0));

myCube->mNode->scale( .1, .1, .5);

i get the box soaring above the ground:



So, the mesh of cube is scaled, but the shape is not scaled. And I don't understand how to make so that the actual physical shape of the body
was equal to the scaled mesh.

betajaen

13-04-2006 10:57:42

Alright, Find out what the original size of the mesh (which since your using my cube it's 1x1x1metres) so you do this:-


body* myCube = mScene->createBody(
"myCube",
"cube.1m.mesh",
new cubeShape(Vector3( 1 * .1, 1 * .1, 1 * .5)),
10.0f,
Vector3(0, 0, 0));

myCube->mNode->scale( .1, .1, .5);


:D

vasquez

13-04-2006 13:37:34

I understood. But for me the main thing - how to scale already created shape. I mean not in 'createBody' function. The matter is that in my program the same box should accept various forms each time when I it shall want.

thanks a lot :)

betajaen

13-04-2006 16:14:11

Do you mean when a mesh that isn't 1x1x1m in size that isn't scaled?

I'm curious what is your natural language? Perhaps a lurker around here could help with a translation if your willing to speak that way?

vasquez

14-04-2006 12:56:58

What function in nxOgre can scale the the actual physical shape of the body?

betajaen

14-04-2006 13:26:51

NxOgre doesn't scale anything; You need to pass on the rough size of the mesh over when you create the body and you can't adjust the size of the body after it's been created.

An example:

You have a shipping container which the mesh is 24 metres long, 2 metres high and 3 metres in width. In NxOgre you use a cubeShape with a parameter of Vector3(24,2,3);

If you want to scale your contianer so it's double in size Node->scale(2,2,2)), You adjust the cubeShape as so:- Vector3(24 *2, 2*2,3*2)

vec3

29-07-2006 21:05:28

Hello everybody, my first post on the forum. First off: thanks for all the effort gone into nxOgre. preview 4 looks great :)


If you want to scale your contianer so it's double in size Node->scale(2,2,2)), You adjust the cubeShape as so:- Vector3(24 *2, 2*2,3*2)

So, is this because physX does not scale?
And I am a bit confused what you are suggesting (if you are at all), are you suggesting creating a new cubeshape everytime a node scales?

betajaen

29-07-2006 21:29:25

In a sense yes; because PhysX or NxOgre don't know if you will scale the node or not.

However, you can remove and add shapes after a body has been created anyway so it isn't much of a major issue.