Sign in to follow this  
  • entries
    7
  • comments
    37
  • views
    6475

Physical rant

Sign in to follow this  

253 views

Today's been a most unproductive day. Unproductive in the sense of progress made, not work commited. Even more unsatisfactory [depressed]

The better part of the day I spent trying to get mesh-mesh collisions going in Ageia PhysX; between our level and some arbitrary object. The thing just went mad with jittering, bouncing, and seemingly random behaviour.

I assumed it was something to do with the way the engine sets up the physics system and objects (skin width, center of mass, inertia tensors, something like that). No luck tweaking values or setting flags.

It all boils down to this. In PhysX, for mesh mesh collisions, you need to create pmaps for the meshes. pmaps only work properly on meshes that represent some sort of closed volume. As far as I can understand from the documentation, the process of generation applies raycasts to find extents of the volume, and further stores this in some sort of voxel structure for faster and more robust intersection tests. Now, our level naturally isn't a closed volume mesh, so ultimatly that screws up the pmap and any hope of arbitrary meshes colliding with the world [smile]

To resolve this I suppose we could remodell the level with closed volume colission meshes, which in turn might make the character interaction less smooth (pluss our level designer will probably be jumping with joy [rolleyes]). Perhaps more realistically, we can restrict all world-interacting bodies to be of convex shapes, which should work fine without pmaps.

None of this is too hard in itself, but working through someone else's wrapper (the engine we're using), hacking and slashing through their indirections, adding here and there, and never quite knowing if a problem stems from a bug in our code, their code, or in Ageia's PhysX itself, makes for a somewhat frustrating experience.

May tomorrow be a better day [rolleyes]
Sign in to follow this  


5 Comments


Recommended Comments

You've learned about the physics system and the engine you're using. While it's isn't something you can hand somebody else to show what you've done, learning is never unproductive. Though I appreciate how frustrating it can be.

I wish you better luck for tomorrow. :)

Share this comment


Link to comment
My understanding is that pmaps are sort of deprecated in the api.

Instead, you can use multiple convex shapes, attached to each other if you need a more complex shape. Ragdoll is one common example of this, but you can combine any set of shapes, and tag as part of the same collision group so they don't intersect each other.

Share this comment


Link to comment
Ye, I came across similar information about pmaps, although they it's not quite clear from the official documentation. In any case, like Jesse said, I've learned [smile]

We'll be building our all game objects from convex, or groups of convex shapes as suggested. The way the engine is set up at the momement, they have a one-to-one binding between actors and shapes, so for objects statically combined of multiple shapes we might have to do some trickery. I don't think we'll run in to any such issue though, since most our game objects should be convext shapes anyway.


Suggestions and input always appriciated. Thanks [smile]

Share this comment


Link to comment
It's been a while since I've touched PhysX (was Novodex back then), but I seem to recall there being a special case handling for terrain/levels. It might have only applied to a heightmap, or something like that, but I do remember it as a special geometry type/object type or something.

Might be worth spending a couple minutes to see if there's something like that still there :).

Share this comment


Link to comment
Thanks for the suggestion. They do support a special case for height map meshes, but that wouldn't work for our level.

After rethinking things, being constrained to convex shapes for dynamic objects interacting with the world isn't really an issue for this prototype. I added this to the engine's physics plugin the other day, and just the default all our rigid bodies to be cooked as convex meshes. As long as we keep that in mind, it works just fine [smile]

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now