toxiclibsjs
                                
                                 toxiclibsjs copied to clipboard
                                
                                    toxiclibsjs copied to clipboard
                            
                            
                            
                        VerletParticle for 3D usage
Only 2D version seemed to be implemented.
yes currently only the code for VerletPhysics2D has been implemented. VerletPhysics for 3D is in the works but is not currently my top priority.
Hi Kyle, This would be great addition to the port. After a brief look through the Java code. Here is an initial list of classes I think would need to be ported:
physics3D
- [ ] ParticlePath3D
- [ ] ParticleString3D
- [x] PullBackSpring3D
- [x] VerletConstrainedSpring3D
- [x] VerletMinDistanceSpring3D
- [x] VerletParticle3D
- [x] VerletPhysics3D
- [x] VerletSpring3D
behaviors
- [x] AttractionBehavior3D
- [x] ConstantForceBehavior3D
- [x] GravityBehavior3D
- [x] ~~ParticleBehavior3D~~
constraints
- [x] AxisConstraint
- [x] BoxConstraint
- [x] CylinderConstraint
- [x] MaxConstraint
- [x] MinConstraint
- [x] ~~ParticleConstraint3D~~
- [ ] PlaneConstraint
- [ ] SoftBoxConstraint
- [ ] SphereConstraint
dependacies
- [x] ParticlePath3D: Spline3D
- [x] Spline3D: BernsteinPolynomial
- [x] Spline3D: LineStrip3D
- [x] AxisConstraint: Vec3.Axis
- [x] BoxConstraint: Ray3D
- [x] CylinderConstraint: AxisAlignedCylinder
- [x] SphereConstraint: Sphere
I was thinking to give this a go. But before I do I have some questions:
- Does this list look about right?
- Is it naive to think that this is just a case of porting the Java files (using your conventions)?
- Is there any other gotchas, things to look out for, or things I am missing?
Thanks, Ross
This progress + code-style looks great. Thanks for contributing and for using the internals where appropriate!
Your list looks accurate, there is no need for the interfaces. It isn't naive, the toxi.physics3d.* package is one that should be straight-forward to port. The biggest "gotcha" is circular dependencies. I don't foresee this being a problem with this package but it is the main obstacle that can complicate code organization. When it does occur it usually results in an error from the internals.extend function.
Spline3D and LineStrip3D are ported and exist currently in the develop branch. They have corresponding tests as well [1] [2]. It looks to me like all of the dependencies outside of toxi.physics3d.* have been ported already.
Awesome, many thanks for the info. I am going to finish up for tonight but it really is nearly all there. Hopefully I will get a couple of free hours to complete it soon, then play with it.
The setup/organization of your library is fantastic.
I have added two methods to the internals:
- find
- removeItemFromReturningSuccessful– erm, grim name sorry. Basically it mimics Java's List#remove().
If you plan to merge and would rather not have the above in the internals let me know and I will remove.
Hello @rc1 while working on the v0.2.0 release I refactored the internals. I believe the only change necessary would be that these 2 additional functions are split into their own files inside lib/toxi/internals/, and if you've used some of the internals.tests functions those references have been renamed. If at any point you want some help let me know or submit a pull request into my feature-physics3D branch and I'd be happy to lend a hand.
thanks!
Hey! Sorry I have dropped the ball on this. Will try and have a look at the weekend...
I was just wondering if verletphysics for 3D is currently supported. Was hoping to try it out but couldn't find any 3D examples here. Thanks!
the Verlet Physics 3D package isnt currently in toxiclibs.js releases. A lot of the work has been done in @rc1's fork here: https://github.com/rc1/toxiclibsjs/tree/feature-physics3D which does include a examples/Physics3D_threejs.html example.
Its nearly all there, I would like to get this into toxiclibs.js proper, just need to find some time to finish it up and write some tests / examples.
Thanks for the reply. That sounds great, really looking forward to seeing this incorporated. Great work on this library, it's amazing!
Hey, erm.... 3 years later.
I have created a new branch for is up-to-date with the latest master. Some notes:
- Added findto./internals
- Dropped the example (for now)
- Still in the same competition state as before
- No tests (untested)
- Minor fix on BoxConstraint
https://github.com/rc1/toxiclibsjs/tree/feature-physics3D-updated
Looks like this thread has been silent for a while. Just curious if there is any sort of timeline for adding 3D physics to this library? It would be extremely useful.
@worsnupd you can try my fork. It's got most of it.
@hapticdata is there anything specific holding up a merge? Let me know if there is.
@rc1 The merge looks good. I just haven't found the time to write unit tests and finish it up at this point.
@worsnupd @rc1 The latest is now here https://github.com/hapticdata/toxiclibsjs/tree/feature-physics3D-updated including new builds. This version includes a few bug fixes and has the latest master merged in.
VerletPhysics3D will be merged into master and released once ParticlePath3D, ParticleString3D and a more thorough unit tests are completed.