Search Unity

Camera Path Animator 3.0 - Animate in Unity with Ease

Discussion in 'Assets and Asset Store' started by jasperstocker, Feb 10, 2014.

  1. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    Rotating the Camera Path is not supported at present. If you need to apply rotations at runtime you could have Camera Path modify an empty game object and use the output to modify with rotations.
     
  2. MaikelXingredient

    MaikelXingredient

    Joined:
    Jul 7, 2015
    Posts:
    2
    Hi,

    I am trying to stop the camera for 5 seconds and look around and after that start moving again,
    is this possible?
     
  3. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    293
    I've actually made a script that does this as I needed it too, I'm off on holiday today but I'll be back next week and I can post it...if it looks clean and usable enough. =O
     
  4. Pawl

    Pawl

    Joined:
    Jun 23, 2013
    Posts:
    108
    Any reason GetPathDirection() doesn't interpolate between the two nearest stored directions for smoother results? We were seeing some noticeable rotational jitter that went away after I replaced the function with something like the following:

    Before
    Code (CSharp):
    1.     public Vector3 GetPathDirection(float percentage, bool normalisePercent)
    2.     {
    3.         if (normalisePercent) percentage = ParsePercentage(percentage);
    4.         return _storedPathDirections[StoredValueIndex(percentage)];
    5.     }
    After
    Code (CSharp):
    1.     private Vector3 GetPathDirectionSmooth(float percentage, bool normalisePercent)
    2.     {
    3.         if (normalisePercent) percentage = ParsePercentage(percentage);
    4.  
    5.         int max = storedValueArraySize - 1;
    6.         int curr = Mathf.Clamp(Mathf.FloorToInt(max * percentage), 0, max);
    7.         int next = (curr + 1) % storedValueArraySize;
    8.         var d0 = _storedPathDirections[curr];
    9.         var d1 = _storedPathDirections[next];
    10.  
    11.         float interp = percentage * max;
    12.         float tLerp = Mathf.Clamp01(interp - curr);
    13.         return Vector3.Lerp(d0, d1, tLerp);
    14.     }
     
  5. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    662
    @jasperstocker Hi, I have a simple path set to once and when I run a cube down it at the end I get this error ..

    CompareApproximately (SqrMagnitude (result), 1.0F)
    UnityEngine.Quaternion:Euler(Vector3)
    CameraPathAnimator:GetOrientation(orientationModes, Single, Boolean) (at Assets/Plugins/CameraPath3Scripts/CameraPathAnimator.cs:377)
    CameraPathAnimator:GetAnimatedOrientation(Single, Boolean) (at Assets/Plugins/CameraPath3Scripts/CameraPathAnimator.cs:433)
    CameraPathAnimator:UpdateAnimation() (at Assets/Plugins/CameraPath3Scripts/CameraPathAnimator.cs:590)
    CameraPathAnimator:Update() (at Assets/Plugins/CameraPath3Scripts/CameraPathAnimator.cs:509)

    Screen Shot 2016-04-07 at 12.55.03.png

    Can you tell me what this means please, thanks.
     
  6. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    I can't.
    Could you please email me your exported path and I'll take a look.
    Jasper
     
  7. Jotunn

    Jotunn

    Joined:
    Jan 10, 2014
    Posts:
    22
    Hi, I use Camera Path Animator 3.51 on Unity5.3.4f1.
    It works fine, thanks.
    But some modify operation is not saved to the scene file.
    For example,
    1. Open a scene include a Camera Path.
    2. Select a orientation point, modify angle in inspector. (at this point, '*' indicating that the file has been changed not displayed on title bar)
    3. Save scene.
    4. Re-open scene, modified angle discarded.
    Add Point (orientation, speed, event ... except path point) is not saved too.
    Modify angle in inspector is not saved, but modify angle by scene view gizmo is saved.
    Modify angle in inspector and done other operation(for example, modify other gameobject in the scene), modified angle is saved.

    Are there any methods to save modifications certainly?
    Thanks!
     
  8. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    I cannot reproduce this issue - everything saves fine here. Are there any errors in the console?
     
  9. Jotunn

    Jotunn

    Joined:
    Jan 10, 2014
    Posts:
    22
    Thanks for reply.
    There are no errors in console.
     
  10. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    199
    Hello

    I want to ask a question. Basically, I will animate the camera but it will stop at some specific points. When user press a key it will again go on animation. How can I achieve this? Is there a way to stop the camera then go on when user enters a key?

    Thanks for your support
     
  11. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    You can assign a 0 value to delay points to make them pause the path animation indefinitely. After that, you can then command the animator component to .Play() when a user presses a key. The keyboard example gives you a example of this.
     
  12. j2l2

    j2l2

    Joined:
    Mar 14, 2016
    Posts:
    14
    Had the same issue.
    Did you make a prefab like me? If so, simply click apply to change prefab ;)
     
  13. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    Ah - interesting! I'll take a look at that.
    Thanks @j2l2
     
  14. imaewyn

    imaewyn

    Joined:
    Apr 23, 2016
    Posts:
    158
    Hey, I'm using this plugin for recording demo video. There is one question that I can't resolve. When I'm trying to connect two splines with interpolation there is small inaccuracy between end of interpolation line and start point of second spline. Because of this this, camera transitions look not smooth. And I'm tried to change variable "interpolation time" or something like this. All the same, second spline don't look like first spline continue. May be I need to create one long long spline and working with this? But I this in this way I will have difficulties with ease...
     
  15. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    @mkgm - could you email/dm me your path as xml? Then I can see what the issue might be.
     
  16. mkgm

    mkgm

    Joined:
    Apr 10, 2015
    Posts:
    134
    @jasperstocker
    the problem was my ignorance :oops:
    Sorry.
    Your assets works perfectly!!!!
     
  17. Gokcan

    Gokcan

    Joined:
    Aug 15, 2013
    Posts:
    199
    Hello
    I am using camera path animator. I set animation speed lets say 10m/s. While animation is playing, at some points animation slows down, then continues as normal. It is not smooth. How can I fix it?
     
    Last edited: Aug 29, 2016
  18. VPsych

    VPsych

    Joined:
    Jan 30, 2016
    Posts:
    1
    @jasperstocker

    Is there a tutorial video or example that goes deeper in how you can use the Broadcast and Call Events in Camera Path Animator with PlayMaker? I'm trying to design a project that's similar in concept to an on-rails shooter but I'm on Unity v5.4 while the tutorial using AngryBots can only be run up to Uinty v4.6.
     
  19. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    Hi VPsych, The demos in Camera Path work fine with Unity 5.4
     
  20. JecksonLiu

    JecksonLiu

    Joined:
    Nov 25, 2016
    Posts:
    6
    @jasperstocker Hello, I met some problems in the use of information: 1 MainCamera Path2 Orientation Point 3 MainCamera Path3 Orientation Point 0 MainCamera Path2 Orientation Point 2 MainCamera Path3 Orientation Point 1, I would like to ask how to solve this? What causes it?
     
  21. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    Hi JecksonLiu,
    What is the problem you're having?
     
  22. JecksonLiu

    JecksonLiu

    Joined:
    Nov 25, 2016
    Posts:
    6
    I don't know, I want the route dynamic, I do not know why, but a place where no error, but there is a hint, that are as follows: 1 MainCamera Path2 Orientation Point 3 MainCamera Path3 Orientation Point 0 MainCamera Path2 Orientation Point 2 MainCamera Path3 Orientation Point 1, did not follow my path want to go
     
  23. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    I'm sorry, but I still have no understanding of your issue. Are you using a script to modify the path at runtime?
     
  24. JecksonLiu

    JecksonLiu

    Joined:
    Nov 25, 2016
    Posts:
    6
    I'm sorry, I use a script dynamic assignment to link camera path, did not clear the beginning of the line, so the assignment of a problem, I think I solve the problem
     
  25. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    Great - glad you got to the bottom of it
     
  26. -woelfchen-

    -woelfchen-

    Joined:
    Aug 17, 2014
    Posts:
    30
    Hey jasper! Is there a way to make waypoints, trigger events, delays etc appear inside the timeline of cinema director? That would be very helpful to sync events correctly

    great piece of software btw
     
  27. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    Thanks - I've not had a chance to dive into CD yet but it's a high priority for me with where CPA is heading this year...
     
    -woelfchen- likes this.
  28. yusefkerr

    yusefkerr

    Joined:
    Apr 5, 2011
    Posts:
    99
    Hello, I have the same question as the one above concerning timeline editor.
     
  29. BLUESurfer-MONSTER

    BLUESurfer-MONSTER

    Joined:
    Oct 12, 2013
    Posts:
    11
    Hi! There's a way to change the "far" of the camera along the path?
     
  30. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    611
    Question 1:
    Is there a way to place path points directly on the surface of the ground by clicking the ground? Or pressing a key while mouse is hovering over the spot to place the path point there?

    I often need to have a path follow a terrain for example, and placing path points on the ground is crucial, without having to manually position the Y value of every single point.

    Question 2:
    I'm having trouble making seamless loops. When going from the final point back to the original point, there is a abrupt change is position/rotation and even placing the first and last points at the exact position, I cannot make a seamless loop. Is there any tricks to getting smooth loops?
     
    Last edited: Oct 14, 2017
  31. Liam-C

    Liam-C

    Joined:
    Mar 6, 2017
    Posts:
    3
    Hi Jasper,

    I've been using Camera Path Animator for a rail shooter game for quite a while. I have one path per stage, but as the stage has become more complex I've added more and more events and other points to the path. Now the path is really hard to work with because the unity editor runs really slow when the path is shown in the inspector.

    In retrospect, I should have used multiple small paths per stage and connected them. Is there any safe, reliable way to split one big path into multiple smaller paths that join together?

    Thanks in advance.
     
  32. andonsky

    andonsky

    Joined:
    Jun 19, 2015
    Posts:
    25
    Hi Jasper, quick question. is there a way we can get an Animation Reversed EventHandler, as I need to set a variable everytime the camera motion is reversed. Please advice if this can be implemented any time soon.
     
  33. jasperstocker

    jasperstocker

    Joined:
    Jul 7, 2010
    Posts:
    386
    Hi Andonsky, is this for the ping pong mode? When is this reverse happening?
     
  34. andonsky

    andonsky

    Joined:
    Jun 19, 2015
    Posts:
    25
    CameraPathAnimator.cs

    Code (CSharp):
    1.  
    2. public virtual void Reverse()
    3.     {
    4.         switch (animationMode)
    5.         {
    6.             case animationModes.once:
    7.                 animationMode = animationModes.reverse;
    8.                 break;
    9.             case animationModes.reverse:
    10.                 animationMode = animationModes.once;
    11.                 break;
    12.             case animationModes.pingPong:
    13.                 pingPongDirection = pingPongDirection == -1 ? 1 : -1;
    14.                 break;
    15.             case animationModes.loop:
    16.                 animationMode = animationModes.reverseLoop;
    17.                 break;
    18.             case animationModes.reverseLoop:
    19.                 animationMode = animationModes.loop;
    20.                 break;
    21.         }
    22.  
    23.     }
    Based on the CameraPathAnimator script I would think we could raise an AnimationReversedEventHandler(); anytime a change to the animationModes happens? I am pausing the camera whenever it hits an event and depending on the logic of my script I either continue the animation or reverse it. This is the code of my Custom Event. As you can see the problem is that the event is hit twice if a reverse animationmode request on the camera is requested.

    For example:
    CameraPosition is at "CameraPathStart" event and the Camera is made to pause. Script request camera to Play and Camera hits the second event "CameraPathCenter", now if an animationMode.reverse is requested instead of flowing back directly to the "CameraPathStart" event it instead will hit the "CameraPathCenter" event again and pause the camera whereas it should have actually continued to the "CameraPathStart" event then paused when it hit the last event.

    This bug only happens when an animationMode switch is requested from any event.

    Code (CSharp):
    1. private void OnCustomEvent(string eventname)
    2.     {
    3.         //Debug this as the events are being hit twice we only need to let the first one pass
    4.         //Problem only happens when reverse is called.
    5.  
    6.  
    7.         //we need to ignore same event when reverse is activated.
    8.  
    9.             //Ex. CameraPathEnd will activate twice after activating reversemode to avoid the subsequent pose
    10.             //let the event passthrough once when a custom event is detected after activating reversemode
    11.  
    12.             if (eventname == "CameraPathCenter")
    13.             {
    14.                 //Hits the section twice
    15.                 Debug.Log("Custom Camera Path event: " + eventname);
    16.                 camanimator.Pause();
    17.  
    18.             }
    19.             else if (eventname == "CameraPathEnd")
    20.             {
    21.                 //Hits the section twice
    22.                 Debug.Log("Custom Camera Path event: " + eventname);
    23.                 camanimator.Pause();
    24.                 camanimator.animationMode = CameraPathAnimator.animationModes.reverse;
    25.  
    26.             }
    27.             else if (eventname == "CameraPathStart")
    28.             {
    29.                 //Hits the section twice
    30.                 Debug.Log("Custom Camera Path event: " + eventname);
    31.                 camanimator.Pause();
    32.                 camanimator.animationMode = CameraPathAnimator.animationModes.once;
    33.             }
    34.             else
    35.             {
    36.                 Debug.Log("Custom Camera Path event: " + eventname);
    37.                 camanimator.Pause();
    38.                 //camsectorHit++;
    39.             }
    40.         }
    41.    
    42.  
     
  35. NatCou

    NatCou

    Joined:
    Jan 29, 2017
    Posts:
    7
    Just adding a little script to instantiate sprites/game-objects along the Camera path (which I purchased a few weeks back)
    hopefully its useful to someone else (my maths is awful so there is most likely a better way of doing it!)
    but it works none the less... you need camera path animator 3-0, drop your game-objects into the array choose spacing and your good to go...

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class InstantiatePrefabOnSpline : MonoBehaviour
    4. {
    5.  
    6.     public CameraPath camPath;
    7.  
    8.     [Range(100, 500)]
    9.     public int spacing;
    10.     public int frequency;
    11.  
    12.     public bool lookForward;
    13.  
    14.     public Transform[] items;
    15.     private float stepSize;
    16.  
    17.     private void Awake()
    18.     {
    19.         if (frequency <= 0 || items == null || items.Length == 0)
    20.         {
    21.             return;
    22.         }
    23.         //stepSize = 1f / (frequency * items.Length);
    24.         stepSize = frequency * items.Length;
    25.         for (int p = 0, f = 0; f < frequency; f++)
    26.         {
    27.             for (int i = 0; i < items.Length; i++, p++)
    28.             {
    29.                 Transform item = Instantiate(items[i]) as Transform;
    30.                 // Vector3 position = camPath.GetPoint(p);
    31.                 float num = camPath.GetPointNumber(camPath.numberOfPoints);
    32.                 Debug.Log("num" + num);
    33.                 //Vector3 position = camPath.GetPathPosition(i/ num);
    34.                 Vector3 position = camPath.GetPathPosition(i * num/ spacing);
    35.                 item.transform.localPosition = position;
    36.                 if (lookForward)
    37.                 {
    38.                     item.transform.LookAt(position + camPath.GetPathDirection(p * stepSize));
    39.                 }
    40.                 item.transform.parent = transform;
    41.             }
    42.         }
    43.     }