Unity3d Fork

Discuss topics related to Bepu Entertainment.
Post Reply
exocraft
Posts: 1
Joined: Wed Jul 31, 2013 6:00 am

Unity3d Fork

Post by exocraft » Wed Jul 31, 2013 6:14 am

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

Norbo
Site Admin
Posts: 4542
Joined: Tue Jul 04, 2006 4:45 am

Re: Unity3d Fork

Post by Norbo » Wed Jul 31, 2013 7:09 pm

Very nice! Thanks for the contribution; I suspect there are more than a couple of people who will find this handy :)

nbg_alta
Posts: 2
Joined: Tue Sep 26, 2017 5:15 pm

Re: Unity3d Fork

Post by nbg_alta » Tue Sep 26, 2017 7:58 pm

Thanks for sharing, but is there a not compiled version of this?

Norbo
Site Admin
Posts: 4542
Joined: Tue Jul 04, 2006 4:45 am

Re: Unity3d Fork

Post by Norbo » Sun Oct 01, 2017 1:51 am

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.)

mcmonkey
Posts: 92
Joined: Fri Apr 17, 2015 11:42 pm

Re: Unity3d Fork

Post by mcmonkey » Fri Oct 06, 2017 4:24 am

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!)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest