Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving Rope in 3.2 (Unity 2017.1.1)
#1
In the previous version of obirope (3.1) we moved the rope by disabling the entire gameobject, moving the rope to where it needed to be, and then re-enabled it.

Currently in 3.2, this method does not work, with the rope reacting unpredictably (wild/erratic movements) whenever we re enable it.
This movement only takes place for the first few seconds after we enable the rope, before it stabilizes.

Is there a better method to move the rope as of 3.2?

Currently we are also having issues with using the local position of the rope, when we choose to simulate in local space then the pin constraint moves incredibly far away almost instantly, which results in deformation once again.

This solution was for when a simulated rope's parent object was moved relative to other objects (player on a moving platform) and we are currently unable to fix this issue as well.

Many thanks.
Contrary Scholars 
Making Klepto: Space thief.
Itch.io
Reply
#2
(04-10-2017, 11:27 PM)ContrarySchol Wrote: In the previous version of obirope (3.1) we moved the rope by disabling the entire gameobject, moving the rope to where it needed to be, and then re-enabled it.

Currently in 3.2, this method does not work, with the rope reacting unpredictably (wild/erratic movements) whenever we re enable it.
This movement only takes place for the first few seconds after we enable the rope, before it stabilizes.

Is there a better method to move the rope as of 3.2?

Currently we are also having issues with using the local position of the rope, when we choose to simulate in local space then the pin constraint moves incredibly far away almost instantly, which results in deformation once again.

This solution was for when a simulated rope's parent object was moved relative to other objects (player on a moving platform) and we are currently unable to fix this issue as well.

Many thanks.

Hi there,

Moving the rope around works exactly as it did in 3.1.1 for us, in fact very little has changed in that department. Make sure that you wait for the next fixed update before reenabling the rope, tough.

If you disable/move/enable all in the same physics update, neither the disabling or enabling do anything: it basically is the same as moving the rope around manually. (note that this approach can work sometimes, depending on whether or not FixedUpdate() was called that frame, but it's a purely a matter of luck. You need to wait for the next fixed update, so that Unity acknowledges that the rope has been in fact disabled).

There's a sample script called ObiActorTeleport.cs included, that you can take a look at to see how to "teleport" a rope around. I'll copy it here for your convenience:

Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Obi;

public class ObiActorTeleport : MonoBehaviour {

   public ObiActor actor;

       void Update () {
       if (Input.anyKeyDown)
           StartCoroutine(Teleport());
       }

   IEnumerator Teleport(){

       actor.enabled = false;

       // change position here. I'm just teleporting the actor somewhere inside a sphere of radius 2:
       actor.transform.position = UnityEngine.Random.insideUnitSphere * 2;

       yield return new WaitForFixedUpdate();
       actor.enabled = true;

   }
}

Regarding your issue with pin constraints in local space, we are unable to reproduce it. Pinning the rope to colliders works exactly the same for us regardless of the simulation space used. Can you elaborate on your setup?
Reply
#3
Hi Jose,

Thank you, that seems to have helped our teleporting issue. 

We are using Obi rope as a mechanical arm for our character and there is a pin set to his elbow's position so it maintains the shape of the arm. When the player is standing on a platform moving upwards, the arm jiggles a lot. In the previous version we seemed to solve this issue by checking the simulate in local space option which stopped the jiggling. 

Now when I tick simulate in local space, the pin behaves very strangely and it gets pushed further away from the player as the player gets further away from the world's origin. I suspect I am using this property incorrectly. Is there some other way I can stop it jiggling on moving platforms?
Contrary Scholars 
Making Klepto: Space thief.
Itch.io
Reply
#4
(10-10-2017, 04:24 AM)Contrary Scholars Wrote: Making Klepto: Space thief.
Itch.io

Hey guys, why don't you show your use of ObiRope and your project in our "Made with Obi" section of the forum??  :-D We'd like to see!
Co-Founder of Virtual Method Studio
Obi product support team
Reply
#5
(10-10-2017, 04:24 AM)ContrarySchol Wrote: Hi Jose,

Thank you, that seems to have helped our teleporting issue. 

We are using Obi rope as a mechanical arm for our character and there is a pin set to his elbow's position so it maintains the shape of the arm. When the player is standing on a platform moving upwards, the arm jiggles a lot. In the previous version we seemed to solve this issue by checking the simulate in local space option which stopped the jiggling. 

Now when I tick simulate in local space, the pin behaves very strangely and it gets pushed further away from the player as the player gets further away from the world's origin. I suspect I am using this property incorrectly. Is there some other way I can stop it jiggling on moving platforms?

Hi there!

Pin constraints are best used together with rigidbodies, as they're meant to inject force back into the body they're pinned to. If your character has a rigidbody at its root this can be specially problematic in local space as it can induce a feedback loop, where the rope moves the character, and the character moves the rope, etc.

Use handles instead.

Edit: Tested a couple use cases with pin constraints. A local-space setup with a solver and a rigidbody at the root of the hierarchy, and colliders/ropes underneath them pinned together, causes the issue you mention, or at least a similar one (the rigidbody starts floating around in a strange fashion while the rope gets pushed far from it). If the rigidbody is not at the root of the hierarchy, it works as expected since the rope is no longer capable of altering its own reference frame.

You can either re-design the character hierarchy to break this feedback loop, or use fixed particles/handles (which are also far more performant than pin constraints).
Reply