stephengold / Libbulletjme

A JNI interface to Bullet Physics and V-HACD
https://stephengold.github.io/Libbulletjme/lbj-en/English/overview.html
Other
84 stars 10 forks source link

Double-precision support for non-rigid body physics objects #19

Closed aecsocket closed 1 year ago

aecsocket commented 1 year ago

Similar to #9 , I am using Libbulletjme for use in a Minecraft plugin, which requires double-precision in world positions, since coordinates can go up to 30 million on the X/Z axes. I see there has already been work done to get/set double-precision physics positions and rotations on PhysicsRigidBody instances, however I also use PhysicsGhostObjects, which from what I can see don't support the *Dp methods. Could double-precision get/set support be added for object types apart from RigidBody (specifically GhostObjects and SoftBodys), and if possible a double-precision variant of get/set Transform methods (at least for the position component)? I make extensive use of Transforms rather than pure vectors, and double-precision utils for those would be very useful.

stephengold commented 1 year ago

It should be a simple matter. Thanks for the suggestion!

stephengold commented 1 year ago

@aecsocket: the work took a week longer than it should've, but I believe v17.1.0 should meet your needs. Please try it and let me know whether it does or not.

aecsocket commented 1 year ago

1.7.10 provides a lot of the methods needed, and is almost perfect for my needs. However it's still missing a few methods which would be useful:

stephengold commented 1 year ago

Thanks for the feedback. I'll keep this issue open until those suggestions are addressed.

aecsocket commented 1 year ago

Doing another pass over my code, one place where double precision would be useful is in joints and constraints. Specifically New6Dof's Vector3f and Matrix3f parameters: if the A end is in world space, the Vector3f may not be precise enough to express the extremes of coordinates. However this is a more niche use-case, since in my code most of the time bodies will be constrained to other bodies.

stephengold commented 1 year ago

I'll take a look at New6Dof and add methods that seem appropriate to me.

I'm curious about your Minecraft plugin. What is its name and purpose?

stephengold commented 1 year ago

I started implementing a double-precision constructor for a single-ended New6Dof. The impact of that change rippled through the com.jme3.bullet.joints package. It seems a much bigger project than I'm prepared to tackle right now, so I'm going to revert the changes and publish v17.2.0 without them.

aecsocket commented 1 year ago

Yes it sounds like joints and constraints will need a lot more work to add dp support. It seems more of an edge case though, so it shouldn't be too high priority.

I'm trying to write a server-side physics framework for Minecraft servers (project CraftBullet), and also developing a (pseudo-)entity-component-system on top of that to allow me to make generic entities (project Sokol). I appreciate your work greatly since without it my ideas wouldn't even be possible! My more long-term aim is to make server-side weapons and vehicles frameworks (projects Calibre, Diesel), for which physics - and a robust ECS - would be essential. On top of those frameworks I could make any project I wanted, one which I have ideas for currently is a first person shooter. I know that you've seen DynamX, which I was also partially inspired by, and although it's an impressive mod, it still requires clients to download it manually, which is why I'm writing server-side plugins. I'd love to show some of it, but right now I don't have anything really "presentable" - maybe in the future!

stephengold commented 1 year ago

Thanks for sharing details about CraftBullet. I'm glad to help out.

Currently the 17.2.0 release is being delayed by an authentication issue at the build server. I've opened a ticket ...

stephengold commented 1 year ago

The 17.2.0 release has been published, so I'm closing this issue. If you wish to propose new features, I invite you to open (a) new issue(s) here at GitHub.