PhyKit -iOS / macOS framework wrapping Bullet + SceneKit integration

Post Reply
AdamEisfeld
Posts: 6
Joined: Tue Jun 16, 2020 6:11 pm

PhyKit -iOS / macOS framework wrapping Bullet + SceneKit integration

Post by AdamEisfeld »

Update: PhysicsKit has been renamed to PhyKit (due to linker issues with Apple's internal PhysicsKit framework) and has been reworked quite a bit, so I'm editing the body of this original post to describe PhyKit)

Hello!

I have created an open source wrapper around Bullet for use in iOS / macOS applications which can be found here https://github.com/AdamEisfeld/PhyKit.

Image

As I have been working on a personal project backed by Apple's SceneKit library (provides an abstraction for rendering 3D scenes via OpenGL / Metal, wired up to a stock physics engine), I found the physics engine implementation that comes with SceneKit to be a little lacking. Primarily, I needed a way to do client-side prediction / server reconciliation, which required the ability to manually "step" the physics simulation forward after applying some historical client inputs, which SceneKit does not support (ironically, I believe Apple is using Bullet under the hood, but their API does not support what I'm after and feature requests from a single developer tend to not happen).

PhyKit is compiled as a universal xcframework, targeting iOS simulators / devices as well as macOS. The framework can be downloaded directly from the repo and dragged into your Xcode project, or you can use Swift Package Manager or CocoaPods to install the framework as a dependency.

At it's core, the framework provides functionality for:
- Creating a physics world (PHYWorld)
- Creating various collision shapes, including from SCNNode geometry (PHYCollisionShape)
- Creating rigid bodies (PHYRigidBody)
- Creating ghost objects (PHYTrigger)
- Attaching rigid bodies to SCNNodes
- Raycasting
- PHYActions (performing a piece of logic on a node over time, such as PHYAction.moveTo(x, y, z, 10) or PHYAction.orientBy(x, y, z, 20)

Contributions welcome!
- Adam
Last edited by AdamEisfeld on Mon Jan 11, 2021 3:13 pm, edited 5 times in total.
AdamEisfeld
Posts: 6
Joined: Tue Jun 16, 2020 6:11 pm

Re: PhysicsKit - Framework wrapping Bullet for iOS / SceneKit projects

Post by AdamEisfeld »

I've removed this comment as I've updated the original post's information.
Last edited by AdamEisfeld on Mon Jan 11, 2021 3:12 pm, edited 2 times in total.
AdamEisfeld
Posts: 6
Joined: Tue Jun 16, 2020 6:11 pm

Re: PhysicsKit - Framework wrapping Bullet for iOS / SceneKit projects

Post by AdamEisfeld »

I've removed this comment as I've updated the original post's information.
Last edited by AdamEisfeld on Mon Jan 11, 2021 3:13 pm, edited 1 time in total.
ortwingentz
Posts: 1
Joined: Wed Jan 06, 2021 9:56 am

Re: PhysicsKit - Framework wrapping Bullet for iOS / SceneKit projects

Post by ortwingentz »

That's funny since SceneKit is already using Bullet under the hood. Did you write an enhancement request? I guess it would be relatively easy for the SceneKit folks to add your features.
AdamEisfeld
Posts: 6
Joined: Tue Jun 16, 2020 6:11 pm

Re: PhysicsKit - Framework wrapping Bullet for iOS / SceneKit projects

Post by AdamEisfeld »

Even funnier is it turns out they also have a private framework called PhysicsKit which was causing linking issues with my framework on certain builds, so I've had to rename it to PhyKit. I haven't filed an enhancement request (I did contact them asking if there was any way to manually step the sim, and was told it was unsupported and wasn't on any roadmap to be added anytime soon). I'll file a request but I doubt it will get much traction without a lot of people asking for it.

On that note, PhysicsKit is now PhyKit, available at https://github.com/AdamEisfeld/PhyKit. I'll edit the original post with that info.
Post Reply