Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Teleporting Rope
#1
Tangentially related to my previous thread (here), but ultimately a different issue, so I decided to make a new topic;

Is there a way to teleport the rope, essentially 'resetting' it at a new position during runtime?

I mentioned my current set up in the previous thread (this post), where the rope object is connected to two anchors, which are then connected to two external game objects. My current attempt teleport all these components, the anchors and game objects teleport fine, but the rope then flies towards them to catch up, causing high velocities and undesired effects.

Cheers!


EDIT:

Seems I was a bit quick to post here! The solution I found was calling the aptly named 'ResetActor()' method in ObiRope.

Should anyone else want it, my implemented solution is as follows;

Code:
    /// <summary>
    /// Moves all components of the rope by a set amount
    /// </summary>
    /// <param name="distanceToMove">The distance to move the rope parts</param>
    public void MoveRopeByAmount(Vector3 distanceToMove)
    {
        //Wire points are the anchor objects
        //Target points are the connector gameobjects attached to the anchors
        for (int i = 0; i < targetPoints.Length && i < wirePoints.Length; i++)
        {
            targetPoints[i].transform.position += distanceToMove;
            wirePoints[i].transform.position += distanceToMove;
        }
        ObiRope.transform.position += distanceToMove;
        ObiRope.ResetActor();

        //Custom method to reset velocity of the rope & it's components
        ResetVelocity();
    }
I'm hoping there's no negative repercussions to using this method I'm unaware of?
Reply


Messages In This Thread
Teleporting Rope - by PhantomBadger - 10-07-2017, 01:56 PM
RE: Teleporting Rope - by josemendez - 14-07-2017, 07:02 PM
RE: Teleporting Rope - by PhantomBadger - 17-07-2017, 02:07 PM