shapeGroup in NxOgre 0.6

Lexx

05-04-2007 16:11:31

hi guys! What's happened with shapeGroup class in NxOgre 0.6? I see realization in nxOgre_shape_compound.cpp, but it's disabled by #if 0 definition... Any info about it?

betajaen

05-04-2007 16:26:13

It isn't upgraded to the new shape system, I'm afraid.

But to duplicate the effect you can do:-

mBody = mScene->createBody(...., new cubeShape(1));
mBody->addShape(new cubeShape(Vector3(1,1,1), Pose(0,4,0));
mBody->addShape(...);


The only difference between that code and a shapeGroup is with a shape group the shapes are passed on to the actor when it is being created and with the alternative code they are after.

Lexx

05-04-2007 16:39:04

ok. thx very much!
btw, Betajaen, can you tell us, when you going to open box with NxOgre 0.9? I'm can't wait for it!!! :)

Lexx

05-04-2007 18:49:44

some news about addShape in NxOgre 0.6

this code doesn't work for me

mBody = mScene->createBody(...., new cubeShape(1));
mBody->addShape(new cubeShape(Vector3(1,1,1), Pose(0,4,0));
mBody->addShape(...);

because function "addShape" has changed in 0.6

NxOgre 0.4rc3

void body::addShape(shape *_shape) {

......

if (_shape->mType == shape::SHAPE_GROUND) {
mActor->createShape(static_cast<groundShape*>(_shape)->mShapeDesc);
}

if (_shape->mType == shape::SHAPE_PLANE) {
mActor->createShape(static_cast<planeShape*>(_shape)->mShapeDesc);
}

......


and NxOgre 0.6

void body::addShape(shape * _shape)
{
//NxReal m = mActor->getMass();
// push back shape thing here.
// mActor->updateMassFromShapes(0,m);

NxReal mass = mActor->getMass();

_shape->__bindToNxActor(this,mActor);
mShape.push_back(_shape);

if( _shape->isDynamic() )
{
mDynamicShape.push_back(_shape);
}
mActor->updateMassFromShapes(0, mass);
}


We have new function "__bindToNxActor".
It's virtual function in class NxOgre::shape and it was implemented only for class NxOgre::wheel ...
So, i have add implementation of this function for spec-shape classes (cubeShape, sphereShape, ...),

void cubeShape::__bindToNxActor(body * b, NxActor * actor)
{
NxShape * pNxshape = actor->createShape(mShapeDesc);
__bindNxShape(pNxshape);
}

and now all this things works!
hope, it will be usefull for someone

betajaen

05-04-2007 19:37:53

Ahh. I assumed it worked, but I'm glad you fixed it. ;)