Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Setup particulart simulation (set ropes/solver at runtime and detect when solved)
#1
Hi, what I am trying to do is to create ropes at runtime and give them set position/rotation/parameters before running a physics simulation. At the moment I am instantiating a bunch of ropes from a prefab with the rope configured to my liking (I didn't try, but I believe I can configure things at runtime if anything?) and obi rope and solver components disabled, give them back to another system that sets it up and enables everything, wait some time then disable solver and use the results. I was wondering how can I make this better. In particular:

- Do I need to spawn ropes with a disabled components, or can I force parameters/rotation/position after the fact of spawning?

- Can I translate and rotate rope after it was simulated to simulate again without changing its particles relative positions/rotations? I can't seem to change position through changing transform in Unity. When I iterate over Obi.ObiRope.solver.positions and add Vector4(0,10,0,0) it works, but instead of maintaining the shape and nicely falling again the physics just explodes. Also why positions are in vector4?

- Can I somehow detect if a simulation is solved, or +- solved? Currently I wait for time, or certain amount of fixed update steps, but if I use different gravity settings the simulation takes different amount of time. I need something like solver.totalenergy, or totalvelocity to say "if it's < x, assume it is solved", or something like simulation.isActive, or ropeRigidBody.isSleeping.

- At the moment I disable/enable the solver if I want to start/stop simulation. Can I do it in any other way? Can I do it per rope like rigidbody.isKinematic?

Thanks!
Reply


Messages In This Thread
Setup particulart simulation (set ropes/solver at runtime and detect when solved) - by uatihb - 13-06-2023, 03:51 PM