Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Changing rope solver constraints settings with script
#2
(06-11-2022, 08:45 PM)Zombie1111 Wrote: Im trying to change the distance iterations option at runtime using a script but I cant get it to work!
Doing this does nothing
grab_holdingRope.solver.distanceConstraintParameters.iterations = 20;
grab_holdingRope.UpdateParticleProperties();

Doing this causes the rope to "drag itself" and fly around all over the place. (Calling both UpdateParticleProperties and UpdateBackend have the same effect)
grab_holdingRope.solver.distanceConstraintParameters.iterations = 20;
grab_holdingRope.solver.UpdateBackend();

Changing the distance iterations option at runtime using the inspector does work! So I guess there is a function or something that I must call after changing the option!? But idk what that function is called and I have tried calling many different functions with no luck.

Hi!

The function you're looking for is solver.PushSolverParameters().

As per the API docs:
Quote:void Obi.ObiSolver.PushSolverParameters()
Updates solver parameters. Call this after modifying solver or constraint parameters.

UpdateParticleProperties() is an internal method that updates particle properties (has nothing to do with constraints) and UpdateBackend() checks whether the solver's backend has been changed (for instance, from Oni to Burst) and if so, it tears down the old backend and reinitializes the solver using the new backend. Neither of these are related to solver/constraint parameters in any way.

kind regards,
Reply


Messages In This Thread
RE: Changing rope solver constraints settings with script - by josemendez - 07-11-2022, 08:50 AM