Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope jiggle after sudden animation position change of handle constraints
#2
(28-08-2019, 11:38 AM)pixhellmann Wrote: I have an animated device which has a rope between two animated elements.
I used the Handle constraint setup on the first and last particle. (works very nicely)

We have many timelines driving this devices animations.
The issue is, that the elements jump positions between the timelines.
So the rope suddenly gets a new position and of course it jumps like crazy to settle down. (impressively robust though!)

I have several ideas to workaround this:
  1. create many ropes - for each timeline one, with a new emitter curve and initialized rest pose, which we than activate per timeline.
    so it starts with at least a somewhat correct pose.
    downside is have have to manually create each curve, create new handle constraints and move them under the two elements.
  2. somehow store initial poses for each timeline and feed this at the beginning of each timeline into one rope as initial pose.
Do you have any other ideas?

I am not a coder but we have some here in the office (but they are extremely busy right now, so as soon as I know which way is possible, I would bother them with that issue Guiño


If you need more clarification please let me know. I can upload a video and share it via PM (since it cant be shown publicly)

Thank you very much!

Best,
Philipp

Hi there!

You need to write a little bit of code for this. When "teleporting" the rope (which is essentially what the timeline is doing), you need to deactivate the rope right before the timeline jumps to a new playback position, and re-activate it after the first FixedUpdate() after the timeline has jumped (you can use WaitForFixedUpdate for this). This ensures the rope does not feel the abrupt change in position.

In Obi/SampleScenes/SampleResources/Scripts/ObiActorTeleport.cs you have an example of this, that will teleport any actor to a random position inside a sphere when you press any key. Pasting it here for 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;

   }
}
Reply


Messages In This Thread
RE: Rope jiggle after sudden animation position change of handle constraints - by josemendez - 29-08-2019, 08:02 AM