Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / [Dark Dynamix] Theory for a destructible vehicle

Author
Message
Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 1st Jul 2012 17:59 Edited at: 1st Jul 2012 18:00
Thought it'd be cool to discuss how you might make a vehicle destructible in Dark Dynamix. I can't really play around with actual code and experiment because I need to save all my coding energy for Carnage, but discussing the theories and concepts would be cool.

What I'd like to do is make a PhysX vehicle that is destructible in the following ways:
- Exterior panels (doors, bonnet, wheel arches, roof) can be deformed and removed from the vehicle after collision.
- The core frame/chassis of the vehicle can be deformed and crushed.

My thoughts on how you would do this go something like this ...
- Make a subframe model for the chassis of the car. This is pretty much a simple flat box with the wheels attached around it, like this image.
- This is setup as a convex mesh in Dark Dynamix.
- When a collision occurs, you get the point of impact and the direction of force (calculated from velocity of the car, the object that it hit, and the directions).
- Select all vertices (red blobs on the diagram) that fall within a certain range of the point of impact and move them in the direction of the force by an amount proportional to the magnitude of the force.
- Recreate the convex mesh physX object for the newly deformed chassis
- Reposition the wheels/suspension connection if the area they are connect to have been moved



The only issue I can see with this is, if the side of the car is crushed inwards (say you slide sideway into a lampost) then the new shape wouldn't be convex, so the physX mesh made wouldn't take into account this new dent. Also, what is the performance overhead for recreating the mesh?

An additional mesh for the cabin could behave in the same way and be attached to the chassis mesh either using a static joint or as a composite object (I think that's possible with convex meshes).

The same goes for the exterior panels. The bonnet, wheel arches, bumpers etc. would all be convex meshes and the vertices used to make them would loosely tie in with the arrangement for the chassis. The means when there's an impact on a front corner, the chassis, bumper and wheel arch would all have verts in similar places, and could all be crushed inways, deforming the car in such a way that the various parts are unlikely to push through each other. When the force is enough, the exterior panel could be detached.

The main things I'm unsure about are:
- What would be the best method for setting the various parts up for collision? Convex mesh seems the only real way.
- Will the convex mesh creation be fast enough to remodel it when the car is deformed?
- When the parts are dented, they'll no longer be convex. I wonder if this would be an issue or if there's a way to deal with it.
- What would be the best way to connect the meshes together?

Any thoughts and ideas from people interested in this idea would be cool.

Attachments

Login to view attachments
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st Jul 2012 19:11 Edited at: 1st Jul 2012 19:12
I think we can agree that doors and wheels being removed is not such a big issue, it can also be done automatically by adding breakable joint limits.

The deformation is another story, but there is already some functionality within PhysX that could do this:

From the PhysX docs:

Quote: "Cloth Metal is a cloth mode which allows cloth to be used to simulate plastic deformation. For example dents in barrels, car bodywork or metal doors can be displayed when there is a large impact on the surface.

Cloth metal is created in a very similar way to other cloth types, first a cloth mesh is created (NxClothMesh) and instances of this cloth mesh are used in the form of NxCloths.

Then to enable the feature a rigid body should be attached to the cloth. The cloth acts as a deformable surface for the rigid body. The cloth automatically becomes rigid when the body is attached. The rigid body is used for simulation until an object hits the cloth with a sufficiently large impulse to cause deformation, at this point the cloth deforms. Following the impact the object is simulated again using the rigid body. Collision is made against cloth vertices, so objects smaller than the distance between cloth vertices might not interact fully with the metal cloth.

To attach the rigid body to the cloth use:


"

Dark Dynamix has the command 'attachToCore' and I did some very light testing and it seemed to work.

How does it work, the hull would be make from either boxes, capsules or spheres, or a combination(compound). You create a cloth for the hull mesh, and then attach your compound actor to it using this command. As explained above, the compound is used most of the time unless a hard collision is detected, then the collision is computed again on the cloth and the mesh is deformed.

I will try to put an example together and see if it works the way we would expect for a vehicle hull. When I tested it, I just used the cloth in the current demo and made it solid by adding a box, it did deform like metal but I suspect a more complex mesh might throw up problems, hopefully not, but nothing is ever straight forward

Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 1st Jul 2012 20:24
That's really interesting Matty. From that and your description, I would imagine you'd set it up by (for a simple cube example):
- Make a box rigid body
- Make 6 cloth objects which fit perfectly to each face
- AttachToCore

I can easily visualize that. Something hit's the cube, which is lined precisely with the cloth. If it's with sufficient force, the cloth can be appropriately dented.

That's cool, but I wonder if it would satisfy my desire to crumple the whole chassis up. If there is a box which is defining the collision zone, I would imagine there is a limit to the amount of denting. If you imagine a full on impact covering an entire face, all the cloth verts would be pushed inside the face of the collision box. Then any further collisions wouldn't affect the cloth. I suppose perhaps you could resize the collision box dynamically though.

I'm sure that tool would work for panels at least. I'd love to be able to half the length of a chassis with the whole thing crumpled up, as if crushed between two trucks.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st Jul 2012 20:40
I don't think it works how you imagine. You have one cloth mesh which is your car body mesh, obviously this would be strange at first as the whole car would crumple up like a cloth

As soon as you attach a box shape the cloth stiffens and is not used until a sufficient force hits the box, then the collision is done again against the cloth and the objects vertices are repositioned. As far as crumpling it up completely then this will probably be limited, would need to test it out to see what the limits are.

My concern is that creating a cloth mesh from the vehicle hull would just fail due to complexity of the mesh, unless it's a simple(ish) mesh. I know soft body meshes are extremely versatile but I'm not sure about cloths, I think I tried to make a cloth from a character model once(just for a laugh) and if failed, that's probably why I'm pessimistic at the moment.

Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 2nd Jul 2012 16:54
After some initial testing I don't think cloth deformation is suitable for a moving dynamic vehicle.

I tested the F1 car in the advanced vehicle demo and as it turns out you can turn this vehicle into a cloth It does not simulate well as a cloth, it just falls apart because there are not enough shared vertices in this particular model, in essence, it is many cloths.

But once you add a box actor with dynClothAttachToCore() the cloth stiffens and the car keeps its shape, it also deforms when I throw spheres at it

So here are the problems, the box actor(core) that is supposed to represent the vehicle in normal conditions resizes itself to fit around the car, taking away your control to have the hull represented in your simulation the way you want it to. After doing many car handling examples I have to say that the hull shape is one of the main things you need to get right.

It is also hit and miss at times, some balls I throw do damage as expected while other do nothing.

The good thing is that it is really easy to set up, so an advanced feature is extremely accessible. But it's not very well suited to a vehicle hull as handling/stability is more important.

It could do a parked vehicle pretty good perhaps, and things like barrels etc but I think a custom solution like in Fallout's top post would be needed for this feature.

My personal feeling is that I probably would not be too worried about accurate collision deformation, it will be lots of work and I'm not sure the player could tell it apart too much from pre determined deformations around the vehicle.

I think think stuff falling off and a good 'dirty' effect would be good enough in general to add a little more realism to the vehicle.

Fallout
22
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 2nd Jul 2012 19:12
Nice one for looking into that Matty. It's a good feature to know about anyway. I'm sure it'd be useful for lots of things.

I think you're right about the car damage detail though. Best to keep it fairly simplified and not worry too much about absolute precision. By that I mean, decouple the visible model from the collision model.

So you could have a car door, made from a convex mesh. When the door is hit, it could deform in a pre-calculate way via animation perhaps. Then you could swap the convex mesh for another one which represents the deformed door. So you could perhaps have 4 variations of how a door can be dented and bent, and 4 convex meshes already prepared. Upon impact you animate to the damaged position and swap the collision mesh.

With all the different components having this own deformation animations and collision mesh variations, the overall effect would be quite unique each time, as there would be lots of different combinations.

Login to post a reply

Server time is: 2024-11-24 13:36:19
Your offset time is: 2024-11-24 13:36:19