acgaudette / nmg-vulkan

Rusty mech engine
23 stars 4 forks source link

Implement experimental softbody builder API #17

Closed acgaudette closed 6 years ago

acgaudette commented 6 years ago

​The large number ​of (some optional) parameters was bothering me.

Instance creation is now​ e.g.​

components.softbodies.build_instance()
​  ​.make_limb(alg::Vec3::one())
​  ​.mass(10.0)
​  ​.rigidity(0.015) // Jiggly
​  ​.for_entity(shape);

​joint creation is now e.g.​

​components.softbodies.build_joint()
  .with_parent(first)
  .offset(alg::Vec3::fwd() * 0.5)
  .xyz(-45.0, 45.0)
  .for_child(second);​

​The limits support swizzling, so you can do .x(...).y(...).z(...) or .x(...).z(...) etc.

​Something seems to be weird about the commit order in the rebase... not sure how that ended up flipped around on GH.