News for hackers. Stuff that matters.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by markdog12 on Saturday June 22, 2019 @06:38PM (#20252077)
Site freezes on Moto G4, latest Chrome after about a second. At least back button still worked.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by gitgud on Saturday June 22, 2019 @09:14PM (#20252670)
How do I use this on mobile? The controls mention touchscreen...
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by connicpu on Sunday June 23, 2019 @06:10PM (#20259002)
Idk if it breaks on other platforms, but Firefox on Android it's working to tap and hold the middle of the screen for the center thruster, left for left thruster, and right for right thruster
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by slavik81 on Saturday June 22, 2019 @04:03PM (#20251455)
How do you ensure stability? Based on the "learn more" section, I would presume the soft body is made up of vertices stitched together with damped springs. Is that accurate?
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by bourgoisloic on Saturday June 22, 2019 @10:58PM (#20253013)
The springs are not damped yet, but for the main example, drag is enabled[1]. This continuously slows down the particles.

Drag is computed[2] for all the particles using something similar to the Drag equation[3].

Also, like electricslpnsld said, having a small enough time step helps.

[1] https://github.com/loicbourgois/gravitle/blob/master/fronten...

[2] https://github.com/loicbourgois/gravitle/blob/master/src/par...

[3] https://en.wikipedia.org/wiki/Drag_equation

Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by joelthelion on Sunday June 23, 2019 @03:41AM (#20253803)
You might want to look into finite elements. That's a bit harder conceptually, but it's not that hard to implement and should be far more realistic and robust.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by electricslpnsld on Saturday June 22, 2019 @08:36PM (#20252542)
I presume by keeping the time step small enough? If you go into the integrator settings in the demo and crank the time step, it does go unstable.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by phkahler on Saturday June 22, 2019 @04:14PM (#20251505)
Like the old xspringies from '93.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by xchip on Saturday June 22, 2019 @08:36PM (#20252545)
I landed my first job 20 years ago by writing a similar demo. It was in ASM on a 80286, I was rendering a torus in 3D and applying physics using a spring/mass model.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by electricslpnsld on Saturday June 22, 2019 @08:38PM (#20252555)
What was the context? Where people still using 286s in 1999?
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by michaelgrafl on Sunday June 23, 2019 @01:20AM (#20253437)
Nope. Probably meant to say 30 years ago.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by neetodavid on Monday June 24, 2019 @09:48AM (#20263464)
Verlet physics are so nifty. A basic implementation with points, springs, gravity, and a simple floor (a Math.max check) produces stunning motion. Going from trying to tune angular momentum calculations to getting believable rotation 'for free' felt like a revelation
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by andai on Saturday June 22, 2019 @04:10PM (#20251486)
Man this is great fun! I got all scrunched up by the circles of doom.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by rgovostes on Saturday June 22, 2019 @02:49PM (#20251077)
This works in Chrome, but not Safari (macOS 10.14.5).
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by boardwaalk on Saturday June 22, 2019 @04:37PM (#20251598)
It indeed works on Safari with WebGL 2.0 enabled (Developer -> Experimental Features)
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by bourgoisloic on Saturday June 22, 2019 @03:55PM (#20251417)
Thank you for the feedback. I will look into this. Maybe the issue is only related to WebGL rendering.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by emilfihlman on Saturday June 22, 2019 @06:59PM (#20252163)
Doesn't work in Chrome : /

E: And started to work, could just have been some fringe issue, the page was just a white screen and didn't respond.

Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by Narishma on Saturday June 22, 2019 @07:52PM (#20252397)
Doesn't work in Firefox 67 on Windows.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by faitswulff on Saturday June 22, 2019 @08:58PM (#20252616)
Firefox 69.0a1 (2019-06-22) (64-bit) chugging along just fine on macOS
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by NikkiA on Sunday June 23, 2019 @08:11PM (#20259553)
Running fine on FF 67.0.4 on win 10 here.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by rectang on Saturday June 22, 2019 @08:10PM (#20252447)
Freezes Firefox 67.0.4 on Mac.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by boomskats on Saturday June 22, 2019 @06:54PM (#20252141)
This is very nice. It works perfectly on a BlackBerry K2 - with full keyboard support :)
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by mdonahoe on Sunday June 23, 2019 @02:30AM (#20253621)
Didn’t work on my iphone
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by sidewinder128 on Saturday June 22, 2019 @09:51PM (#20252793)
It would be possible to use SDL2 with rust for rendering too.
Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by aloer on Saturday June 22, 2019 @06:09PM (#20251971)
super interesting. Is there a blog post somewhere?

how much better is the performance due to rust/wasm compared to implementing the physics in JS?

Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by bourgoisloic on Saturday June 22, 2019 @11:12PM (#20253073)
Thank you. There is not, but on the readme you can find a few links to learn more[1].

I don't have solid metrics, but using only JS for a previous attempt, I couldn't have 8 points running smoothly [2]. Now it works with 500[3].

I'm not sure whether it's because I have a better understanding of the problems now or just because Rust/wasm is way faster, but what is sure is that Rust makes it easier to write performant code, even if it's harder to learn at first.

[1] https://github.com/loicbourgois/gravitle#learn-more

[2] https://loicbourgois.github.io/treeminor/demo/heart

[3] https://loicbourgois.github.io/gravitle/playground.html?test...

Re:Show HN: Gravitle – 2D soft-body engine built with Rust f... by hu3 on Saturday June 22, 2019 @07:27PM (#20252302)
Freezes in Firefox mobile on a LG G5.