3.3 create hollow box


When i spawn fluid particles into a rigid static box, simulation bring them back to the closest face then a collision seems to be performed.

What i would like to do is to use a rigid static box as a container. Is that possible ? (just using physx primitives, not a mesh)

I guess i have to flip the box normals or something like that, but it doesn’t seem to be possible.

Thanks !


From your description the normals seems to be off, could you double check normals for the colliding face(s)?

Hm, that’s weird. I just enabled the reading of normals, and i get a segfault when reading them :

pf->setParticleReadDataFlag(PxParticleReadDataFlag::eCOLLISION_NORMAL_BUFFER, true);
        PxParticleReadData* rd = pf->lockParticleReadData();
        if (rd)
            PxStrideIterator<const PxParticleFlags> flagsIt(rd->flagsBuffer);
            PxStrideIterator<const PxVec3> positionIt(rd->positionBuffer);
            PxStrideIterator<const PxVec3> normals(rd->collisionNormalBuffer);

            for (unsigned i = 0; i < rd->validParticleRange; ++i, ++flagsIt, ++positionIt, ++normals)
                if (*flagsIt & PxParticleFlag::eVALID)
                    // access particle position
                    const PxVec3& position = *positionIt;
                    const PxVec3& normal = *normals;
                    cout<<"Collision normal #"<<i<<" "<<normal.x<<" "<<normal.y<<" "<<normal.z<<endl;
            //return ownership of the buffers back to the SDK

The documentation says :

Collision normals of colliding particles. The collision normal buffer is only guaranteed to be valid after the particle system has been simulated. Otherwise collisionNormalBuffer.ptr() is NULL. This also applies to particle systems that are not assigned to a scene.

But i do this after the simulation call :


Just so you can see a little bit better, here is what is get :


Particles also don’t really behave like SPH water particles : i tried the parameters from Matthias Müller 's 2003 paper (Particle-Based Fluid Simulation for Interactive Applications). And i also tried the parameters from the physx sample. In both case i have weird behaviors.

But what disturbs me the most is this collision thing right now.

Do you have any idea about that ?


The particles seem to form the sentence “This video is private.” instantly. ;-)

Oups ! I fixed it ! Any idea ?