Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Moving Rope in 3.2 (Unity 2017.1.1)
#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


Messages In This Thread
RE: Moving Rope in 3.2 (Unity 2017.1.1) - by josemendez - 05-10-2017, 05:19 PM