nargil
23-10-2008 00:58:04
Solved
_________________________________________
solution: the usage of nxv.cross() was wrong! It should be .dot(). The return value of NxVec3.dot/cross confused me.
At least you guys have now an almost working (you know what to fix) of scaling a body/actor (not working for convex/triangle yet)
_________________________________________
[color=red][size=200]Click here to see a working example[/size][/color]
I'm scaling a body (actor) so I need to recreate its shapes
it->first-> is NxOgre::Body*
from what I see
NxOgreShapePrimitives.cpp
at
mShapeDescription.NxShapeDesc.ccdSkeleton == 0
mShapeDescription.NxShapeDesc.name == 0
Is that the case ? How do I create a proper skeleton / name for it ? Or maybe am I passing somewhere a wrong pointer/value ?
_________________________________________
solution: the usage of nxv.cross() was wrong! It should be .dot(). The return value of NxVec3.dot/cross confused me.
At least you guys have now an almost working (you know what to fix) of scaling a body/actor (not working for convex/triangle yet)
_________________________________________
[color=red][size=200]Click here to see a working example[/size][/color]
I'm scaling a body (actor) so I need to recreate its shapes
it->first-> is NxOgre::Body*
void cSelekcja::skaluj(Ogre::Vector3 skala)
{
NxActor* actor;
NxShape* shape;
NxU32 flags;
NxOgre::ShapeParams sp;
std::vector<BodyVec>::iterator it;
for(it = this->obiekty.begin(); it!=this->obiekty.end();it++)
{
actor = it->first->getNxActor();
for(unsigned int i=0; i<actor->getNbShapes(); i++)
{
shape = actor->getShapes()[0];
std::cout << "\n\n\n skaluje \n\n";
sp.setToDefault();
flags = 0;
for(int j=0; j<=20; j++)
{
if(shape->getFlag((NxShapeFlag)(1<<j))) flags+=(1<<j);
}
sp.mClothFlags.fromNxU32(flags);
sp.mFluidFlags.fromNxU32(flags);
sp.mShapeFlags.fromNxU32(flags);
sp.mSoftBodyFlags.fromNxU32(flags);
sp.mGroup = shape->getGroup();
sp.mGroupsMask = shape->getGroupsMask();
sp.mLocalPose.M = shape->getLocalOrientation();
NxVec3 nxv;
nxv.cross(NxOgre::NxConvert<NxVec3, Ogre::Vector3>(skala),shape->getLocalPosition());
sp.mLocalPose.t.set(nxv);
sp.mMass = actor->getMass() / (NxReal)actor->getNbShapes();
sp.mMaterial = shape->getMaterial();
//sp.mSkeleton._First->acquire(shape->getCCDSkeleton());
sp.mSkinWidth = shape->getSkinWidth();
if(shape->isBox())
{
nxv.cross(NxOgre::NxConvert<NxVec3, Ogre::Vector3>(skala), shape->isBox()->getDimensions());
it->first->addShape(new NxOgre::Cube(nxv, sp));
}
else if(shape->isSphere()) it->first->addShape(new NxOgre::Sphere(shape->isSphere()->getRadius()*skala.length(),sp));
else if(shape->isCapsule()) it->first->addShape(new NxOgre::Capsule(shape->isCapsule()->getRadius()*skala.length(),shape->isCapsule()->getHeight()*skala.y,sp));
it->first->removeShape((NxOgre::NxShapeIndex)0);
//actor->releaseShape(*shape);
}
}
}
skaluje
PhysX Error! NXE_INVALID_PARAMETER (f:\scmvista\experimental\PhysX_2.8.1_GPU\nov
odex\SDKs\Physics\src\NpActor.cpp:602)
Actor::createShape: desc.isValid() fails!
[NxOgre] NULL or invalid shape was attempted to be assigned to this shape-
[NxOgre] 'NxOgre-Shape'.
from what I see
NxOgreShapePrimitives.cpp
at
void Cube::createShape(NxActor* actor, NxShapeIndex index, Scene* scene) {
(...)
NxShape* shape = actor->createShape(mShapeDescription);
(...)
returns 0. mShapeDescription.NxShapeDesc.ccdSkeleton == 0
mShapeDescription.NxShapeDesc.name == 0
Is that the case ? How do I create a proper skeleton / name for it ? Or maybe am I passing somewhere a wrong pointer/value ?