Very complex buildings problem

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
zygmuntix
Posts: 8
Joined: Wed Mar 28, 2012 11:26 am

Very complex buildings problem

Post by zygmuntix »

Hi,
I am now creating a 3D game with my team and I decided to use BEPU for its physics. But I don't know how to divide a complex model like pyramid with many passages in it so that it could be used with BEPU. There are so many walls in this pyramid, this model is very complex shape and I would like to just use some functions that will automatically divide this model into the best submeshes (if it is possible) that would be collision shapes. The other way that I thought out is that I can get collision shapes by myself in the code, without any functions. Or maybe it would be better to use StaticMesh? But then in every frame BEPU would go through all triangles of the pyramid (pyramid has 5818 vertices so it maybe is not a best idea?). What is the best idea? I will of course have many other 3D models, that I would like to add to game too.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Very complex buildings problem

Post by Norbo »

StaticMesh is the best option for large, immobile meshes. It has a very fast acceleration structure that avoids testing unnecessary triangles. Check out the BEPUphysicsDemos in the main source download to see examples of it in action.
zygmuntix
Posts: 8
Joined: Wed Mar 28, 2012 11:26 am

Re: Very complex buildings problem

Post by zygmuntix »

Thank you very much for your answer :)
When I go inside this pyramid, will be the objects around pyramid 'active'? Is there any way to divide StaticMesh in parts, so that only submeshes of StaticMesh around the player will be checked? (Will be made the collision test for objects around it, or all objects in space would be simulated?) Is there any way to set in what radius/in what space around player objects should be simulated?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Very complex buildings problem

Post by Norbo »

When I go inside this pyramid, will be the objects around pyramid 'active'?
StaticMeshes are immobile and are incapable of activating, and so cannot activate anything else.
Is there any way to divide StaticMesh in parts, so that only submeshes of StaticMesh around the player will be checked?
The StaticMesh's acceleration structure is very fast and does the job of pruning out faraway triangles without the need for separating the mesh. It can handle many thousands of triangles even on slow platforms like WP7/Xbox360.
(Will be made the collision test for objects around it, or all objects in space would be simulated?) Is there any way to set in what radius/in what space around player objects should be simulated?
Everything in the simulation is simulated. The closest it comes to not simulating any element of the simulation is deactivated objects; when dynamic entities sit around idle for a little while, they go inactive and use up far less resources. They will be activated automatically when anything interacts with them.

If you want to have only a subset of objects in the simulation at any given time because you're worried about performance, you must handle that manually. However, be sure that you actually need to do that before you do it. My (old) PC can handle a thousand characters walking around on a big mesh and each other with good performance. Chances are, trying to stream in parts of your simulation on the fly will only be beneficial in the context of a huge world (MMO style) or if you're running on an extremely resource constrained platform like WP7 with more objects in play than the device can handle at once.
Post Reply