A House / Building source code ?
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
A House / Building source code ?
I have a question,
Have you got a source code for a house or a building ?
Have you got a source code for a house or a building ?
Re: A House / Building source code ?
The StaticMeshDemo would be the most relevant example. Structures are not usually built out of a bunch of separate entities like boxes and spheres; instead, they are constructed from loaded meshes.
If you do want to use a bunch of primitives to make a structure rather than a mesh, the StaticGroupDemo would be useful. The StaticGroup allows the combination of thousands of static collidables- boxes, meshes, and everything else- into one efficient representation.
If you do want to use a bunch of primitives to make a structure rather than a mesh, the StaticGroupDemo would be useful. The StaticGroup allows the combination of thousands of static collidables- boxes, meshes, and everything else- into one efficient representation.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: A House / Building source code ?
Okay,
And bepuphysics engine can do breakable sets like house, buildings, etc ... ? Because staticMesh is static ^^ and can't be breakable, no ?
And bepuphysics engine can do breakable sets like house, buildings, etc ... ? Because staticMesh is static ^^ and can't be breakable, no ?
Re: A House / Building source code ?
Destructibility is often accomplished by swapping from the static representation to a 'destroyed' version with optional dynamic debris. This gives you maximum performance when everything is static, while still letting you blow stuff up.
There's nothing built in to help manage this, but it's pretty easy to do. For example, just add/remove objects as needed when the associated gameplay object goes below a certain "HP" value.
More advanced forms of destructibility, like stress-based fracture, are also possible, but are quite a bit harder to implement than the swapping approach. I have an implementation of dynamic compound fracturing used in a little prototype spaceship game which uses such a system quite effectively; that's where the CompoundHelper splitting stuff came from. I've been intending to polish this implementation up and release it as part of BEPUphysics but I haven't yet gotten around to it- but it is definitely possible!
There's nothing built in to help manage this, but it's pretty easy to do. For example, just add/remove objects as needed when the associated gameplay object goes below a certain "HP" value.
More advanced forms of destructibility, like stress-based fracture, are also possible, but are quite a bit harder to implement than the swapping approach. I have an implementation of dynamic compound fracturing used in a little prototype spaceship game which uses such a system quite effectively; that's where the CompoundHelper splitting stuff came from. I've been intending to polish this implementation up and release it as part of BEPUphysics but I haven't yet gotten around to it- but it is definitely possible!
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: A House / Building source code ?
You don't have a little source code for me ?Norbo wrote: I've been intending to polish this implementation up and release it as part of BEPUphysics but I haven't yet gotten around to it- but it is definitely possible!

Re: A House / Building source code ?
The fracture system really isn't fit for public consumption; releasing such features prematurely tends to cause more work for me than actually getting them to a usable state first 
Also, the swap-based destructibility is actually a better fit for many games anyway. It's simpler, easier, faster, and more controllable.

Also, the swap-based destructibility is actually a better fit for many games anyway. It's simpler, easier, faster, and more controllable.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: A House / Building source code ?
But it does not support the point of impact. Imagine, a tank shoots a building and the replacement model has a destruction which is not located at the site of impact, the report will be poor, right? There is no better solution?Norbo wrote:Destructibility is often accomplished by swapping from the static representation to a 'destroyed' version with optional dynamic debris. This gives you maximum performance when everything is static, while still letting you blow stuff up.
Re: A House / Building source code ?
That is easy enough to handle by swapping out the affected section of the mesh, rather than the entire mesh. You can make the destructibility as detailed as you desire.
There's no way around designing the destructible pieces with the desired level of detail, unless you want to go for pure procedural object fracture- that is, taking a single volume and making it many without designing the result at content creation time. This is doable, but is much harder than even the dynamic compound fracturing I referred to previously. In addition, the results are somewhat difficult to control- you'd probably end up designing 'destructible pieces' just to help guide the procedural fracturing process.
Another difficulty step above that would be to just run full FEA, with volumetric elements constructed procedurally from source content according to some material properties. Then, you could add a bunch of fancy tricks that would end up making it look something like DMM by Pixelux. Of course, to get there, you'd spend about as much time working on it as Pixelux did.
There's no way around designing the destructible pieces with the desired level of detail, unless you want to go for pure procedural object fracture- that is, taking a single volume and making it many without designing the result at content creation time. This is doable, but is much harder than even the dynamic compound fracturing I referred to previously. In addition, the results are somewhat difficult to control- you'd probably end up designing 'destructible pieces' just to help guide the procedural fracturing process.
Another difficulty step above that would be to just run full FEA, with volumetric elements constructed procedurally from source content according to some material properties. Then, you could add a bunch of fancy tricks that would end up making it look something like DMM by Pixelux. Of course, to get there, you'd spend about as much time working on it as Pixelux did.

-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: A House / Building source code ?
Hum... I'm waiting for you source code men.
Are you sure that you don't have any sample using bepuphysics ?
Are you sure that you don't have any sample using bepuphysics ?
Re: A House / Building source code ?
I would not recommend waiting on me to release that dynamic compound splitting thing. The first version of it was made back in mid 2011Hum... I'm waiting for you source code men.

I do not have a sample available showing swap-based destructibility, but it is very simple. All that has to be done is: 1) remove the 'healthy' version, 2) add the 'destroyed' version, 3) toss any extra debris in there that you want.Are you sure that you don't have any sample using bepuphysics ?
You can choose however much detail you want. For example, you might have a car just be one whole destructible object which has one healthy and one destroyed version. But for a house, you might decide to make each wall have its own healthy and destroyed state, so that you can blow them up independently based on where an impact occurs. Or perhaps each wall has ten separate chunks, so that you can destroy individual pieces of each wall.
-
- Posts: 91
- Joined: Tue May 14, 2013 12:17 pm
Re: A House / Building source code ?
I didn't understand how you know where a object collide in a other object, can you help me ?
Re: A House / Building source code ?
You could use either use collision events or check a collidable's contacts.
For the latter option: every collidable knows the list of collision pairs in which it is involved. These are stored in the Pairs list. For example, to get the pairs an entity is involved with, you check the entity.CollisionInformation.Pairs list, because the CollisionInformation property returns the collidable associated with the entity. Another example: a StaticMesh is a collidable itself, so you can just check StaticMesh.Pairs.
Each one of those pair objects has a Contacts collection. If there exist any contacts in that collection with a nonnegative penetration depth, then the pair of objects is touching. (Note that you cannot merely check the Contacts.Count to know if two objects are touching in general: contacts may have negative penetration depth, representing a speculative contact. Speculative contacts are used for stability and continuous collision detection purposes, but do not represent a current collision.)
For an example, check out the CharacterController's QueryManager; it performs this kind of scan to look for supports.
Either way you do it, the contact data tells you the collision position and other information.
For the latter option: every collidable knows the list of collision pairs in which it is involved. These are stored in the Pairs list. For example, to get the pairs an entity is involved with, you check the entity.CollisionInformation.Pairs list, because the CollisionInformation property returns the collidable associated with the entity. Another example: a StaticMesh is a collidable itself, so you can just check StaticMesh.Pairs.
Each one of those pair objects has a Contacts collection. If there exist any contacts in that collection with a nonnegative penetration depth, then the pair of objects is touching. (Note that you cannot merely check the Contacts.Count to know if two objects are touching in general: contacts may have negative penetration depth, representing a speculative contact. Speculative contacts are used for stability and continuous collision detection purposes, but do not represent a current collision.)
For an example, check out the CharacterController's QueryManager; it performs this kind of scan to look for supports.
Either way you do it, the contact data tells you the collision position and other information.