How can I update a rope after I change the material or the end. If I am running a level, and I click on the initialize button, the rope will freeze.
If I use the code from the grappling hook, the rope ends, get pinned. Sample code below.
I need to update the rope in runtime and have it keep settings.
#2) what is "avoid translating MeshColliders at runtime using their transform." Do u have better description or screen shot?
#3) Is there an easy way in code to set phase? I would like to set all of the particles to int X on a rope.
public ObiRope rope;
public ObiRope Rope = new ObiRope();
public ObiSolver Solver = new ObiSolver();
public Material ColorMat = new Material("");
public ObiCatmullRomCurve Curve = new ObiCatmullRomCurve();
public ObiRopeCursor Cursor = new ObiRopeCursor();
void MakeRope()
{
if (Rope == null)
Rope = gameObject.AddComponent<ObiRope>();
if (Curve == null)
{
Curve = gameObject.AddComponent<ObiCatmullRomCurve>();
Rope.ropePath = Curve;
}
if (Solver == null)
{
Solver = gameObject.AddComponent<ObiSolver>();
Rope.Solver = Solver;
}
// Provide a solver and a curve:
Rope.GetComponent<MeshRenderer>().material = ColorMat;
//Configure rope and solver parameters:
Rope.SectionThicknessScale = 0.10f;
Rope.resolution = 1f;
Rope.BendingConstraints.stiffness = 0.2f;
Rope.UVScale = new Vector2(1, 5);
Rope.NormalizeV = false;
Rope.UVAnchor = 1;
Rope.RestLength = 10;
Solver.distanceConstraintParameters.iterations = 15;
Solver.pinConstraintParameters.iterations = 15;
Solver.bendingConstraintParameters.iterations = 1;
//Add a cursor to change rope length:
Cursor = Rope.gameObject.AddComponent<ObiRopeCursor>();
Cursor.rope = Rope;
Cursor.normalizedCoord = 0;
Cursor.direction = true;
}
public void UpdateRope()
{
StartCoroutine(CreateRope());
}
private IEnumerator CreateRope()
{
yield return rope.GeneratePhysicRepresentationForMesh();
}
If I use the code from the grappling hook, the rope ends, get pinned. Sample code below.
I need to update the rope in runtime and have it keep settings.
#2) what is "avoid translating MeshColliders at runtime using their transform." Do u have better description or screen shot?
#3) Is there an easy way in code to set phase? I would like to set all of the particles to int X on a rope.
public ObiRope rope;
public ObiRope Rope = new ObiRope();
public ObiSolver Solver = new ObiSolver();
public Material ColorMat = new Material("");
public ObiCatmullRomCurve Curve = new ObiCatmullRomCurve();
public ObiRopeCursor Cursor = new ObiRopeCursor();
void MakeRope()
{
if (Rope == null)
Rope = gameObject.AddComponent<ObiRope>();
if (Curve == null)
{
Curve = gameObject.AddComponent<ObiCatmullRomCurve>();
Rope.ropePath = Curve;
}
if (Solver == null)
{
Solver = gameObject.AddComponent<ObiSolver>();
Rope.Solver = Solver;
}
// Provide a solver and a curve:
Rope.GetComponent<MeshRenderer>().material = ColorMat;
//Configure rope and solver parameters:
Rope.SectionThicknessScale = 0.10f;
Rope.resolution = 1f;
Rope.BendingConstraints.stiffness = 0.2f;
Rope.UVScale = new Vector2(1, 5);
Rope.NormalizeV = false;
Rope.UVAnchor = 1;
Rope.RestLength = 10;
Solver.distanceConstraintParameters.iterations = 15;
Solver.pinConstraintParameters.iterations = 15;
Solver.bendingConstraintParameters.iterations = 1;
//Add a cursor to change rope length:
Cursor = Rope.gameObject.AddComponent<ObiRopeCursor>();
Cursor.rope = Rope;
Cursor.normalizedCoord = 0;
Cursor.direction = true;
}
public void UpdateRope()
{
StartCoroutine(CreateRope());
}
private IEnumerator CreateRope()
{
yield return rope.GeneratePhysicRepresentationForMesh();
}