Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rope Enable/Disable
#1
I'm attempting to disable/enable the rope at runtime, I'm correctly disabling/enabling the Obi Rope object, the two anchors at either end, and even the solver, however, upon enable the rope then starts flying around violently, either crashing Unity or flying out of the room into the abyss.
Is there a function or anything I should be calling/doing after re-enabling the rope to allow it to settle properly.
Reply
#2
(04-07-2017, 10:43 AM)PhantomBadger Wrote: I'm attempting to disable/enable the rope at runtime, I'm correctly disabling/enabling the Obi Rope object, the two anchors at either end, and even the solver, however, upon enable the rope then starts flying around violently, either crashing Unity or flying out of the room into the abyss.
Is there a function or anything I should be calling/doing after re-enabling the rope to allow it to settle properly.

Hi PhantomBadger,

If your rope has rigidbodies attached to its ends, or it is attached to something that moves while the rope is disabled via handles, it will have to keep up with the movement after you re-enable it. If this movement is large enough this can inject high velocities in the rope, which make it overshoot.

Without more details on what your setup is, I can't really go into details about how to solve the issue.

cheers!
Reply
#3
(04-07-2017, 11:20 AM)josemendez Wrote: Hi PhantomBadger,

If your rope has rigidbodies attached to its ends, or it is attached to something that moves while the rope is disabled via handles, it will have to keep up with the movement after you re-enable it. If this movement is large enough this can inject high velocities in the rope, which make it overshoot.

Without more details on what your setup is, I can't really go into details about how to solve the issue.

cheers!

No worries, let me try and describe our set up in a little more detail.

The rope is connected to two end-point objects (which are rigidbodies), these end-points are then attached to some other rigidbody objects via FixedJoint components.

I am experiencing this high velocity even without any of the objects in question moving between the enable/disable, if I highlight them all and toggle it in the inspector I get this effect. If I can offer any additional images/videos/etc to make our set up clearer please let me know Sonrisa

Thank you for your time, any ideas?
Reply
#4
(04-07-2017, 01:01 PM)PhantomBadger Wrote: No worries, let me try and describe our set up in a little more detail.

The rope is connected to two end-point objects (which are rigidbodies), these end-points are then attached to some other rigidbody objects via FixedJoint components.

I am experiencing this high velocity even without any of the objects in question moving between the enable/disable, if I highlight them all and toggle it in the inspector I get this effect. If I can offer any additional images/videos/etc to make our set up clearer please let me know Sonrisa

Thank you for your time, any ideas?


I assume you are using pin constraints to attach the rope to the rigidbodies. 

What version of Obi Rope are you using? I can't get to reproduce this in the latest one. See this quick video (not the best quality ever, sorry Triste) I did of a relatively complex joint setup with rigidbodies and a rope, it can be disabled/enabled just fine. Disabling the entire GameObject yields the same result. Also tried two non-kinematic rigidbodies, one at each end and enabled/disabled them together with the rope object, works fine.



If using 3.1, would it be possible for you to share your scene (or a video of it) so that we can take a closer look?

If not, I'd recommend updating since 3.1 introduced much stabler pin constraints, and fixed a few rigidbody-related bugs. 

cheers! 
Reply
#5
(04-07-2017, 04:54 PM)josemendez Wrote: I assume you are using pin constraints to attach the rope to the rigidbodies. 

What version of Obi Rope are you using? I can't get to reproduce this in the latest one. See this quick video (not the best quality ever, sorry Triste) I did of a relatively complex joint setup with rigidbodies and a rope, it can be disabled/enabled just fine. Disabling the entire GameObject yields the same result. Also tried two non-kinematic rigidbodies, one at each end and enabled/disabled them together with the rope object, works fine.

[Removed Video so I could add my own]

If using 3.1, would it be possible for you to share your scene (or a video of it) so that we can take a closer look?

If not, I'd recommend updating since 3.1 introduced much stabler pin constraints, and fixed a few rigidbody-related bugs. 

cheers! 

I am using 3.1.1 I believe, I've attached a few diagrams as well as a video/gif of the scene in question.

The following diagram shows the rope set up,
[Image: ViM1wCr.jpg]
A & E: Two 'Connector' models, which have Rigidbodies and mesh colliders further within
B & D: Two 'Anchor' objects, which have sphere colliders and rigidbodies, during runtime they are attached to the connectors via FixedJoints via a WireManager script
C: The Obi Rope instance, with some of the end particles being attached to the relative anchor objects

The WireManager script is mainly for some VR interaction stuff, dynamically changing the mass of the object at either end to allow certain interactions, however it does try to keep the positions of the anchor objects in the same place as it's paired connector object, The method responsible for this is as follows, and is called every FixedUpdate tick;
Code:
   /// <summary>
   /// Updates the position & rotation of the wirePoint to match the transform of the targetPoint
   /// </summary>
   /// <param name="wirePoint">The wire point to update</param>
   /// <param name="targetPoint">The target point to use as reference</param>
   private void UpdateTransforms(GameObject wirePoint, GameObject targetPoint)
   {
       wirePoint.transform.position = targetPoint.transform.position;
       wirePoint.transform.rotation = targetPoint.transform.rotation;
   }
If you would like the entire script that can be provided, but it would have to be through private channels (ie, via email) due to the nature of the project it's a part of Sonrisa

The following is the hierarchy setup for the scene, Point A and B are the two anchor objects identified above
[Image: n0aF19f.png]

Here's a video of the result when enabling/disabling the Plug Wire, Connection A, and Connection B objects, The same happens when also enabling/disabling the ObiSolver or Plug Wire's children with it. In the below video the rope is sitting on top of a simple box collider in order to make it easier to see Sonrisa


If I can provide any additional help, or if you'd like me to provide the scene, please let me know!

Thanks again!
Reply
#6
Bump, any ideas?

I managed to get a temporary solution by making the anchors kinematic prior to the disabling, however Moving the whole thing whilst it's disabled is causing inconsistent behaviour.
Reply