Righto! 0.2 is up now! Seee the first post for download links and more info on the examples.
below is a changelog / some release notes. I've put important bits that i'd like some feedback on in bold, the rest of it might be a bit much to wade through
Added IPhysxManager::setGravity(vec) which allows you to change the gravity at any points
Fixed up some inaccuracies in the heightfield. Basically Physx likes to use signed shorts for its heightmap data whereas Irrlicht likes using floats... obviously that's not hugely compatible so I put in a multiplier to the height values (100) to fake a float to 2 decimal places which is then divided out by Physx later on which produces a very good approximation.
The crashing cloth example seems to have been fixed... at least with the meshes i'm using... I'm using a mesh created in Milkshape3D which is just a flat plane of 6x6. That results in no exit crash but using an 8x8 grid does... very bizarre.. must be a memory bug somewhere. I can still make the cloth example crash if I create around 100 tearable meshes but that could just be down to running out of memory or something... it appears to crash in PhysxCore.dll, I shall investigate further!
Added ConvexMesh and TriangleMesh support, check out the Mesh Example to see those in action.
Added IClothPhysxObject for better/more sensible access to Cloth functions. Hence moved attachToObject & applyWindToCloth from IPhysxManager. There's also lots of other cool new functions in there to check out.
If you make a static compound object (multishape bounding box with 0 density) this is apparently bad for performance and you're warned in the console. instead use a triangle mesh object
Added IPhysxMesh which changes IPhysxManager::createCloth() (used in tri/convex meshes also). Basically these meshes have to be 'cooked' (rearranged into a Physx friendly format) before creating an object and this can take a fair bit of time (just long enough to not be good to do whilst running your game) and so we do it once for each mesh and then reuse that cooked mesh when creating objects.
renamed the old createBox/createCloth etc functions to createBoxObject/createClothObject to not conflict with createConvexMesh etc
Added tearable param to createClothObject to set the cloth to tearable. You also have to have created the cloth IPhysxMesh as tearable but that doesn't mean your IClothPhysxObject has to be tearable if you don't want it to be so you can use the same IPhysxMesh for the same pieces of cloth with one cloth object being tearable and one not.
Added capsule object support (see MultiShape Example)
Added raycasting functions. IPhysxManager::raycastAllObjects(line3df) && IPhysxManager::raycastClosestObject(line3df). first return array of objects hit, latter returns only the first object hit (see Raycast Example). Note that cloths are not included in these raycasts but can be raycasted individually via IClothPhysxObject.
Added SSceneDesc parameter to createPhysxManager and resetScene(). this allows you to setup the Physx scene with some useful parameters. currently the params just optimise scene queries such as raycasting, you probably won't really need to use them unless your performance becomes poor from lots of raycasting.
Changed multishapeboundingboxobject function to multishapeobject and allowed not only boxes but sphere and capsule shapes to be created (updated Multishape example)
Heightfield example shows a new type of heightfield creation now as well, check the first post for info on this. Note that rotation doesn't work nicely on the ITerrainSceneNode type... gona work on that more for 0.3, should be ok for now, heightmaps aren't normally rotated much anyway and you can line them up manually if need be! (note that the function now takes the terrain node rather than its parameters, this should reduce API breakage with the hopeful fix for rotation)
for the addition of capsule objects i've created a VERY simple capsule scene node which is just a butchered sphere scene node bascially. It has bad lighting (due to the normals being created as if it were a sphere) and the texture mapping is all wrong around the midsection, but what the hell.. it does the trick for the examples and if you need a better solution then you can use meshes created in a modelling program or improve upon my capsule scene node.
added IPhysxObject::setLinear/AngularVelocity() & ::setLinear/AngularDamping() (check the docs for notes on how this affects the object if it's a cloth object)
All the examples now have a param editor so you change the gravity and other parameters easily. the default gravity of -9.81f doesn't look at all realistic in the examples, try -60

, or even a positive number! make sure you use a negative for conventional style gravity of downwards! within IrrPhysx you can have 3D gravity but in the param editor i'm just letting you change it on the Y axis. press Q to release the mouse from controlling the camera so that you can change the values. Note that increased gravity seems to give worse performance in certain situations... probably due to harsher forces being computed. I'm going to investigate other options for getting realistic looking gravity effects.
The second terrain creation is bit messed up on edge in the example.. i'll fix it in time hopefully... if any one has ideas as to why it might be happening then speak up!
I've added a parameter to createPhysxManager() to disable hardware usage. This is useful for a game's server and client running on the same machine and you'd want to let the client use the hardware so you can set the server to not use the hardware as the first application to try to use the hardware will get access and lock all others out.
I've pointed this out in the examples and probably in this thread before but you shouldn't add objects during the simulation. The contact callback is called during simulation as the contacts are detected so you shouldn't add objects from within the contact callback. You're allowed to remove objects during the simulation because i've buffered the removal of objects if a simulation is in process so that they get removed upon the start of the next simulation rather than during it.
Right, that's about it i think, let me know if there's any problems!
[ADDITIONAL]
Here's some stuff about the game example i forgot to mention:
The game example shows you how to read the current scene and create physx objects from the nodes, so it's good if you're using .irr files. In the example i've used the node's ID in IrrEdit to specify the density of the physx object and i've tagged the name with '(Cloth)', '(Trimesh)' or '(Convex)' to dictate object type to create and included 'Flag' in an objects name marked with '(Cloth)' to make it wave in the wind.
XXX_physx.ms3d meshes are loaded and used for some physx objects instead of the render mesh and then later removed as they are no longer necessary after the objects are created. Note that these meshes don't have any textures on them as they're not for rendering so the texture cache doesn't get bogged down with any unecessary textures. For convex meshes we don't really need a physx version as it just takes the vertices and forms a convex shape around it (a shape that completely encloses the verts using minimal polygons) so doesn't care about the mesh's complexity.
I've got a simplistic physx mesh cache implemented, i'm leaving this up to you to handle to give the best flexibility but providing this simple mesh cache for those who aren't the best coders! note that all cloth meshes are created tearable you can then decide whether to make the actual cloth object created using the mesh tearable or not (still uses 3x memory though so you might want to change the mesh cache from creating all cloths tearable).
Do people agree that the physx mesh cache should be left up to the user like this? Or should i sort of nick IMeshCache from Irrlicht and implement one within IrrPhysx? I guess i could do that fairly easily...
press R to reset the scene, this shows you how you can wipe out the scene and reload a new one for a different level
ote that you can't shoot the floor beneath you as you hit the camera sphere (press V to see it). i'll add features to do masking on objects when raycasting later.
Note also that you can't see the impact effect on parts of the house (window and door frame) due to the physx mesh version not enclosing those parts of the render mesh so the mesh is rendered over the impact effect. basically anything you'd want to be shot would have to be enclosed so you could make the mesh bigger to enclose it all or more complex to enclose the necessary bits.
Shooting the flag tears it at the intersected vertex and also adds a bit of velocity to make it appear like it's been shot.