This project is read-only.

How the BEPUPhysic works ?

Oct 28, 2011 at 3:15 PM


I have tried to use the BEPUPhysicManager but i don't know how it works.

I have see the BEPUCollisionMove class but this class is never instancied so there is no physic applied in my game because there is no physic object added to the manager (It's the BEPUCollisionMove then add the physic objects in the manager list).

What is the good way to use the manager and apply the physic on my objects ?

Thank you in advance. 

Oct 29, 2011 at 5:49 PM

Hi rc183,

The BEPUPhysics is meant to be used as the current SunBurn CollisionManager implementation: you don't submit anything to the manager, it's automatically handled for you when you create the instance and associate it with a ICollisionObject implementation class instance.

Up to, everything was performed when you created a BEPUCollisionMove inherited class instance (BoxCollisionMove, SphereCollisionMove, ConvexHullCollisionMove or StaticMeshCollisionMove). It would then get destroyed when the ICollisionObject class instance is finalized (BEPUCollisionMove implemented IDisposable and performed all cleaning internally).
However, this system introduced a major failure as the BEPUCollisionMove never raised the Trigger event when required.

Therefore, I just changed the BEPUPhysicsManager to look for the current ICollisionObject class instances (using ObjectManager.FindFast() and filtering through the returned values) and initialize all the BEPUCollisionMove instances when found for the first time.

So, the method is still the same, either create a class that inherits from SceneObject and add one of the BEPUCollisionMove inherited classes instance and it'll work directly.
You can also create a SceneObject instance and add the BEPUCollisionMove instance to the CollisionMove property.

Be sure to add the BEPUPhysicsManager instance to the current SceneInterface instance using Application.SunBurn.AddManager() method and you'll be set.

Oct 31, 2011 at 1:25 PM


Thank you very much for your answer.

I think i have the version. I will check this.

Nov 2, 2011 at 12:51 AM


I have retried with the new version. I don't know if i have understand correctly.

If i look at the code, the collision with bepu only works if i implement myself a BEPUCollisionMove.

So if i have used a default SceneObject in my scene (associated by default with a Sunburn CollisionMove), no physic is applied to my sceneObject (only the BEPUCollisionMove instances are initialized) ?

It's not possible to change dynamicaly the type of the default Sunburn CollisionMove to a specific BEPUCollisionMove depending of the Collision Type defined in the editor (Sphere, Box, Hull) ?

Thank you in advance.

Nov 2, 2011 at 10:31 AM


I first went down this way: the BEPUPhysicsManager would retrieve all ICollisionObject instances from ObjectManager and then replaces their CollisionMove instance with a BEPUPhysicsCollisionMove depending on the HullType(Sphere, Box, Mesh) and its UpdateType(Dynamic or Static).

While being very easy to use, my first prototype leant me to something very limited to extend. WIth such approach, you cannot go in the BEPUPhysics Entity mechanism for instance and tweak its properties because it's unsure you'll share the same properties accross different Entity<TShape> instances.

Therefore, I decided to create multiple BEPUCollisionMove classes and leave it to the developer to create their SceneObject precisely.

The reason for that design direction is that I consider that if you need to use BEPUPhysics in your game, it's because the SunBurn CollisionManager doesn't provide you enough.

My advice would be to use SunBurn CollisionManager if your game doesn't rely on heavy and complex physic interactions. IGF BEPUPhysics integration will leave you of a great control on, how your game entities interact physically with each other but it'll ask you to get on code (which would have probably been the case anyway).

If I can next come up with a good design alternative for in SunBurn editor controls, I'll go for it but for now, I didn't find any good way to do it.

Nov 2, 2011 at 1:46 PM

Ok. Thank you for this answer. I think i will create my own object manager to dynamicaly associate the BEPUCollisionMove depending of the collision type in the editor to not break my game.

For each sceneObject, i will try to the check if there is a BEPUCollisionMove associated with it. If not, i will create it ,else i would do nothing.

Thank you !