20-08-2018, 04:32 PM
(This post was last modified: 20-08-2018, 04:36 PM by josemendez.)
(20-08-2018, 10:10 AM)h00man Wrote: hi, i been trying to make a grapple hook similar to the included one in the package,when i shoot the hook game object and it sticks to other objects i need the robe to be much less stretchy.im using a simple script to control the prematers of distance constraints ,it works fine and it changes the parameters correctly .the problem is , it only changes the numbers .the real changes only going to be applied when i insert the numbers to obi solver manually.
how do i change the distance parameters like iteration and relaxation by script and see it actually happen in the play mode?
and here is the code:
public void less stretch()
{
obiRopi.GetComponent<ObiSolver>().distanceConstraintParameters.iterations = 38;
obiRopi.GetComponent<ObiSolver>().distanceConstraintParameters.SORFactor = 1.5f;
}
Hi,
Just call
Code:
obiRopi.GetComponent<ObiSolver>().UpdateParameters();
Hint: reducing Unity's timestep or increasing the amount of solver substeps might work much better for reducing rope stretchiness.