Changes to Curtain
Yesterday and today I made some long needed changes to Curtain‘s code. Most of it is behind the scenes stuff. The most noticeable change will be how it interacts with the mouse. It should now be a lot smoother and when the user is tearing (right clicking), it wont just tear at points it sees the cursor at, but it’ll tear ALL points between the cursor’s current and previous positions. Meaning it’s now a lot easier to slice the curtain in half with just one swipe.
You might also notice changes in the speed since the majority of the changes are optimization. You’ll only notice it if Curtain was laggy or slow for you before this update. To try out the newly optimized Curtain, check it out here. You can also check out its source here or here. To see a list of updates, jump to the end of the post.
In addition to cleaning up some of Curtain, I’ve made a completely new version of the fabric simulator with my main emphasis on performance. Check it out here.
Changes made to Curtain:
- Removed unnecessary “fixedDeltaTimeSeconds = fixedDeltaTime/1000″ in code.
- leftOverDeltaTime now properly accumulates
- Made changes to Particle.updateInteraction (it’s moved to along side the physics update)
- Simplified some function parameters (namely Link’s constructors and function inside Particle)
- Moved Link drawing into Link, instead of Particle
- Removed translate(width/2,height/2) in draw
- Removed a for loop for drawing, and put the drawing into the physics loop with the condition of it only running on the last loop
- Moved the pinned constraint in Particle’s update() to solveConstraints()
- Interaction now takes into account every point between pmouse and mouse