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: http://www.exocraftgame.com/build/bepu/Web.html, as well as a fork with the source code for the demo: https://bepuphysics.codeplex.com/Source ... 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!
Cheers,
Bryan
Unity3d Fork
Re: Unity3d Fork
Very nice! Thanks for the contribution; I suspect there are more than a couple of people who will find this handy ![Smile :)](./images/smilies/icon_smile.gif)
![Smile :)](./images/smilies/icon_smile.gif)
Re: Unity3d Fork
Thanks for sharing, but is there a not compiled version of this?
Re: Unity3d Fork
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.)
(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
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!)
(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!)