Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Teleporting rope across scene causes rope to behave like slingshot)
#1
Hi,

We are using a player character equipped with a harness and a rope with 2 hooks attached to the harness.
The player can attach/detach for safety on various objects in the scene.

When switching between scenarios, we teleport the player and his gear to other parts of the scene.

When we translate(teleport) the player, his harness and hooks appear immediately in the correct spot, but
the obi rope starts flying towards the player like a giant slingshot, trying to catchup to the hook endpoints it is attached to.

It happens for a couple of seconds and then everything is ok.

But many times it gets stuck on various geometry in the level.

QUESTION 1: Is there a way I can turn Obi rope off for a small amount of time, move it to the correct destination and then turn back on?

This is our current attempt at solving this issue.

Code:
        public void TeleportRope(Vector3 pos, Vector3 rot, Vector3 rotAxis, float rotDeg)
        {
        ropeEndpointBig.transform.position += pos;
        ropeEndpointBig.transform.RotateAround(rot, rotAxis, rotDeg);

               ropeEndpointSmall.transform.position += pos;
        ropeEndpointSmall.transform.RotateAround(rot, rotAxis, rotDeg);

            rope.enabled = false;
            rope.PullDataFromSolver(ParticleData.POSITIONS);
            rope.PullDataFromSolver(ParticleData.VELOCITIES);

            rope.transform.position += pos;
            rope.transform.RotateAround(rot, rotAxis, rotDeg);

            StartCoroutine(EnableRopeNextFrame());
        }

        private IEnumerator EnableRopeNextFrame()
        {
            yield return null;
            rope.enabled = true;
        }
Reply


Messages In This Thread
Teleporting rope across scene causes rope to behave like slingshot) - by mandark83 - 28-08-2020, 02:34 PM