Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope disappears when camera is close
#8
(22-05-2025, 10:06 PM)Paul1 Wrote: Ok, this works now. Problem was, because obi solver, for some reason, did not get bounds of the rope (I don't know how this works).
When I change the rope, i also need to do this everytime (I don't know why, but it solved my problem):
Code:
            obiRope.transform.SetParent(null);
            obiRope.transform.SetParent(obiSolver.transform);
Thank you for your help!
Best, Paul

Glad you found the cause!

When you parent an actor under a solver, the actor is added to the solver and bounds get recalculated. Swapping the actor's blueprint for a new one also triggers this. You typically need to set the parent transform after instantiating an actor, as per the manual:

https://obi.virtualmethodstudio.com/manu...ctors.html

Quote:// create a rope:
GameObject ropeObject = new GameObject("rope", typeof(ObiRope), typeof(ObiRopeExtrudedRenderer));

// get component references:
ObiRope rope = ropeObject.GetComponent<ObiRope>();
ObiRopeExtrudedRenderer ropeRenderer = ropeObject.GetComponent<ObiRopeExtrudedRenderer>();

// load the default rope section:
ropeRenderer.section = Resources.Load<ObiRopeSection>("DefaultRopeSection");

// instantiate and set the blueprint:
rope.ropeBlueprint = ScriptableObject.Instantiate(ropeBlueprint);

// parent the cloth under a solver to start simulation:
rope.transform.parent = solver.transform;

kind regards,
Reply


Messages In This Thread
Rope disappears when camera is close - by Paul1 - 21-05-2025, 12:30 PM
RE: Rope disappears when camera is close - by josemendez - 23-05-2025, 08:26 AM