Page 1 of 1

Unity3d Fork

Posted: Wed Jul 31, 2013 6:14 am
by exocraft
Hey all,

I just recently moved to Unity3d from XNA - and overall I've been really happy with the transition.... although I really miss BEPU.

Sure... Unity3d has PhysX, but the API is very limited compared to what BEPU has to offer, and you get much less control. My game will feature dynamic environments, and with BEPU I can do a lot of things that aren't possible with Unity+PhysX (multiple physics spaces, custom collidables, multithreading - not to mention all the great support Norbo gives on this board!!). I thought I might be able to get by with just PhysX, but it turns out a main bottleneck in my game right now is when I build new physics meshes during runtime- PhysX spends a ton of time baking the mesh. I recall BEPU was extremely fast on XNA for the same sorts of meshes (and I had some intense meshes I threw at it), so I feel now is the time to get BEPU integrated with Unity.

Since BEPUPhysics is dependency free, which is awesome, it basically works out of the box, so most of the work is creating replacement behaviors to interface with Unity3D. There's a few weird issues with Unity's (custom) implementation of Mono, especially in their WebPlayer - I had to turn off ALLOWUNSAFE, unfortunately, since the Mono runtime was having issues (mostly with casting). ALLOWUNSAFE works great in non-webplayer builds, though.

I have a quick and dirty demo up here:, as well as a fork with the source code for the demo: ... raft/Unity

Not sure if there are any other Unity users lurking around, but hope this is helpful if you are... And thanks Norbo for making this incredible physics engine!


Re: Unity3d Fork

Posted: Wed Jul 31, 2013 7:09 pm
by Norbo
Very nice! Thanks for the contribution; I suspect there are more than a couple of people who will find this handy :)

Re: Unity3d Fork

Posted: Tue Sep 26, 2017 7:58 pm
by nbg_alta
Thanks for sharing, but is there a not compiled version of this?

Re: Unity3d Fork

Posted: Sun Oct 01, 2017 1:51 am
by Norbo
I don't think I've seen a packaged unity fork, no. I don't maintain one, at least.

(Fortunately, this long lived annoyance will partially go away with v2, since it's just a .NET Standard 2.0 library. So long as unity supports that, it'll run. Some questions remain about unity's timeline for .NET standard and SIMD acceleration, but I suspect it'll be fine in the long run.)

Re: Unity3d Fork

Posted: Fri Oct 06, 2017 4:24 am
by mcmonkey
Last I looked, BEPU physics 1.x works more or less out-of-the-box on Unity, you just copy the BEPU physics 1 source into your Unity source directory, and it functions.
(You of course have to create your own Unity<->BEPUphysics links, EG ensuring a BEPUphysics space is prepared, and translating your Unity shapes to BEPU ones... but that's all fairly simple as well, for a capable coder!)