23-05-2025, 08:26 AM
(This post was last modified: 23-05-2025, 08:28 AM by josemendez.)
(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):
Thank you for your help!Code:obiRope.transform.SetParent(null);
obiRope.transform.SetParent(obiSolver.transform);
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,