Long time not posting here. This isn't because I stopped working with NGD, but because I'm playing around with it and almost simulating a racing car with very good results.
But, what brings me here is another thing: Only for fun, I'm trying to shot down an airplane here. To do this, I built the various parts of plane in different collisions. So, I can detect where my shot hits. Now, I want to stick the parts together. Is easy to do it creating joints. But I think that creating a NewtonBody for each part and compute the physics for every part will demand an unecessary processor resource.
Have some way to attach 10 parts but compute physics only for one of them, and make the another only follows what it does?
Compound collision cannot be broken, and this annoyed me. I tried to use joints, and the result was close was I wanted. Now, I'm working with a method that will allows me to simulate the break of compound collisions, and I think that will work very fine!
Fixed joints wont work as they are not really stiff and take rather a lot of power to compute. Creating compounds is rather fast, you should be able to do it real time when detaching parts.
AHa, is exactly what I thought! As is composite inside an array, is only rebuild the collision without the missing part. I can make a NULL collision part of the array?
The problem is that the pieces of my airplane are distributed in a 0..8 array. So, I know what the part are by the number. For example, the plane[5] is the Wing. So, when I want to break out the wing, I "NULL" the plane[5] and rebuild. That way, if you are still in flight and loose the rudder, I'll make plane[3] NULL and rebuild. So, you'll lost the wing and the rudder, capisce?
If I simply remove from the array I'll have to reorder and pass it to the software. I'll need an index of parts... more problems...
You could just create a second array when you are creating the convexhull and populate it with the bits that should be a part of it. Then send the 2nd array to newton. That way you still have your original array intact.
Are this way possible to release parts of compound object? For example, I want to make a spaceship model, consisting of a parts of hull in array, like written here. And when the ship will be destroyed, I need to release all parts in free flight saving basic speed, vector and angular speed of compound object and do not releasing connections between random neighboring parts.
The demo in the SDK is broken now. However all the funtionalitu is in the NewtonMesh SDK.
This is not a trivial feature to put together precedurally, because it requires lots of user interface. That is why I stopped making the demo more pollished and I start working of a Graphical editor.
In that video the parts are made by doing random cuts to the the mesh and it took a lot of massagimng to get it right. considering that it is a precedural demo it came out very good, but is I would hate to do it other model. as the features become more intertwined with the Graphics I not longer can continue making precedual demos. To remedy that I stop working on demos and start working on an editor that hopfully will help people to use all of the features in newton visually. Basically the editor will help you to put together the scene and save to to a file that to can use a s a blue print to load teh result in your game.
The editor will not anything magic, it will just use the power of the engine to help people model scenes in a easier way than trying to figure out how to use every single function. Unfortunally that is nature of the beast that as featire becoem more sofiticated theay are also harder to underntand and use by teh casual user. with teh editro I will try to harder teh creativity an dteh inteligence of all user not just teh one teh can undertand the code.
Check the video to see if it is what you are lookin for, and tel me I can explain more how to get teh effect wit the engine.
There is another way to do what you want. What master Julio said is the best way to destroy a battleship, because you can loose random pieces (at least, this way I understood). But if you want to release a part of the compound (for example, you received a shot in the left wing an it flew away, spinning!) you can use the following method: - Build all the pieces of ship separated; - Put is on an array; - Build the compound collision.
When you receives a shot: - saves all the information of the body you'll need (speed, forces, torque and position). - destroy the NewtonBody - set the lost part as an NullCollision (not a NULL pointer) - rebuild the CompoundCollision - rebuild body - set everything back.
You can, now, set the flying wing: - before setting the lost part as null pointer, make another body with it; - apply a torque to it (to make spinning) - apply a force to make it 'eject' from the ship (was thrown away by an explosion, don't forget) - count some seconds and destroy the body (or leave it there if you want).
This is some steps I used to shoot down a Me109 over here. I'm making more interesting graphics to show a video of it. As you can see, the limit of the Newton Dynamics engine is our immagination!
basically it combine a NetwonMesh with a compound collision, and let you detache teh pice you want to detach at run time, in a very efficent way. There si a demo in SDK samples of hwo it is used.
It is no teh simpler but I will try to make it mode data driven.