I can't scale a body visual representation

rafa.gdev

29-05-2008 06:03:09

Hello, I read in a previous post an answer of Betajen to a similar issue: "Just because the visual side of the body is scaled doesn't mean that NxOgre will take notice or even care about that. You need to scale the shape as well."

(http://89.151.96.106/phpBB2addons/viewt ... 6f4e2718c6)

I have the inverse problem: my visual representatoin isn't updated. Here's my code:

boxShape = new Cube(1, 10, 1, "mesh-scale: 1 10 1");
Body* box = mScene->createBody("cube.1m.mesh", boxShape, position, "static: yes, node-scale: 1 10 1" );

I thought that adding the "mesh-scale" parameter would solve the problem but it didn't, the box visual representation isn't scaled. Can someone help me? Thank you very much!

Gohla

29-05-2008 07:56:00

Get the body's node using:
((NxOgre::OgreNodeRenderable*)(mBody->getRenderable()))->getNode()
and scale that.

Or if you want a 'prettier' way you could follow this guide: http://www.nxogre.org/Inheriting_Actor_ ... type_class
and create your own body class with a getNode or scale function (the RenderableFactory is only for '22 so you can't do that yet).

betajaen

29-05-2008 10:23:14

It's "model-scale" not node-scale or mesh-scale, and it needs to be part of the NodeRenderableParams.

rafa.gdev

30-05-2008 06:03:13

OK, it works \o/, I used Gohla's approach, thank you so much!

Thanks.