magbo Posted August 7, 2020 Share Posted August 7, 2020 Hi, I came upon this awesome video by Sebastian Lague and was wondering how to do it in Houdini. In short, he makes a solar system sim by implementing the universal law of gravitation in code. I want to replicate the two planets "dancing" at the beginning. I'm pretty new so please forgive me if my methods are noobie. 1. The first thing I tried was copying the code into an attribute wrangle but got stuck on how to mimic the loops he makes by each timestep to update the velocity and position. 2. Then I though it would be easier with POPs, and indeed just by using "pop axis force" one particle orbit was easily simulated. But I again got stuck when trying to do it with two particles, as I want to feedback each planet (particle) position so it can update the "pop axis force" 's centroid (this failed as the centroid is determined before the solver, so it doesn't update). Maybe looping by for each timestep? merging solvers? I'm lost and going nuts hahah. How would you approach this? Thanks in advance!! (Btw check Sebastian Lague channel, I'm pretty sure if you use Houdini you'll like what he makes.) Quote Link to comment Share on other sites More sharing options...
Librarian Posted August 8, 2020 Share Posted August 8, 2020 links to have Fun ( In first link you have Nice ex how to read csv and other formats..(Python))and make visualization..and if you do a searching you can find A Ton of ex on JSON format reading into Houdini... https://github.com/UTSDataArena/examples http://bluevisual.tv/personal/shnops/ https://gist.github.com/olihawkins https://github.com/kristinriebe/solarsystem-workshop.. .. regarding movement mass velocity and other stuff.. https://www.utas.edu.au/__data/assets/pdf_file/0006/415536/BenSimons.pdf ..use chops and you have in the first link how to read(for ex-- bacteria .. Have Fun 1 Quote Link to comment Share on other sites More sharing options...
eimk Posted August 8, 2020 Share Posted August 8, 2020 Sebastian Lague's stuff is really cool - you have great taste. His code can be translated pretty much directly into VEX; sqrMagnitude becomes length2(), normalized becomes normalize(), and the equivalent of timeStep is the @TimeInc attribute. The key part is putting it inside a solver so the positions are updated each frame, based on their positions from the previous frame. Here's my attempt: (I'll post the file if you're still having trouble but it's a bit messy) 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.