body scale!

ghiboz

11-05-2007 15:13:42

hi I use this sample code to make a cube:

myCube = mScene->createBody(
"myCube", "cube.1m.mesh",
new nxOgre::cubeShape(1), 1.0f,
nxOgre::pose( Vector3(-3,3.5,3),
Quaternion(Radian(Degree(45)),Vector3::UNIT_Y)
)
);

and works
but, if I need to apply a scale to this object, how can I do??
thanks
and last thing,
if my mesh is trimesh, what can I use instead of nxOgre::cubeShape(1)??

thanks :wink:

daedar

11-05-2007 16:30:13

maybe something like this:


PhysicEngine::getSingleton()->getNxScene()->createBody("box.mesh", new NxOgre::CubeShape(5,5,5), Vector3(0,50,0), "Mass: 15, node-scale: 10 10 10");


I haven't tested yet, just looked at the sources so I'm not sure... I'm interested about the trimesh shape too :wink:

ghiboz

11-05-2007 16:35:21

about trimesh i think that works this:

nxOgre::body *myHead = mScene->createBody(
"ogrehead",
"ogrehead.mesh",
new nxOgre::meshShape("ogrehead.mesh", mScene),
1.5f,
nxOgre::pose(
Vector3(-2.5,50.5,2.5), // Put it at -3, 0.5, 3
Quaternion(Radian(Degree(55)),Vector3::UNIT_Y) // Rotate it 45 degrees on the Y axis
)
);

about the scale seems that doesn't work!
bye

betajaen

11-05-2007 18:04:54

You can't use a meshShape with a dynamic body like that it has to be a static body.


For scaling the scenenode's entity you do; mBody->mNode->scale(w,h,d);

ghiboz

12-05-2007 08:54:18

You can't use a meshShape with a dynamic body like that it has to be a static body.
thanks, but how can I do this?
the sample above seems to work fine!
thanks! :wink:

daedar

12-05-2007 08:56:25

With NxOgre 0.9:

mScene->createBody("cube.1m.mesh", new CubeShape(1,1,1), Vector3(0,3,5), "static: yes");

and with NxOgre 0.6 maybe something like:

mScene->createStaticBody(...);

ghiboz

12-05-2007 09:09:47

thanks, but I wish a dynamic body with a trimesh mesh!
(I'm using the 0.4 RC 3) :wink:

betajaen

12-05-2007 09:17:14

You can't. It's a limitation of the PhysX physics engine.

ghiboz

12-05-2007 09:33:41

You can't. It's a limitation of the PhysX physics engine.
argh!
also for phisx 7?
i'm trying to develop a car simulator, and I think that this stuff is very important, to check the colisions between the car and the objects

thanks! :wink:

daedar

12-05-2007 09:38:27

This limitation is for ALL physics engines (Newton, ODE, PhysX). It would take tooo much time to compute I think...

But you can use more than one primitive shape for your car (maybe 4-5 CubeShape would do the trick).

betajaen

12-05-2007 09:41:13

Yep, usually most complicated objects are just a collection of shapes joined together as a compound body. I usually use convex shapes for each portion of the car.