Graphics

 View Only
  • 1.  "Animate to..." suggestions.

    Posted 03-02-2017 17:27

    I'm working on something with an animated camera; the camera can animate to any one of seven different locations, and I want to be able to animate directly to any of the other six positions. You cannot know ahead of time which of the seven locations the director will want to go.... I am writing an external application to run the scene directors to the location that gets called by the director.

    The "animate to" paradigm would be where you could just set the last keyframe of the animation, and it would start the object where it currently exists in space. That doesn't work, and that's fine - there's a number of reason to not do it that way (not the least of which is you can't set the TCB).

    My solution was to put a script event as the first frame of a scene director, the animation controller would follow 1 or two frames later. The script sets the first keyframe on the animation controller for camera object (actually using the setKeyframeValueTCB method).

    I thought I had it working late last night (although I may have been delusional by that time), but today it seems like, even though the scene director time is outside of the animController (before) when the script is triggered, that the camera jumps to the first keyframe of that anim controller first, so that the script is ineffectual.

    I could put the script at the end, and reset ALL the anim controllers first key frames to where the camera ends up. Since the whole system is "paused" by the end of the animation, even if it takes more than a frame to complete, it shouldn't cause any issues, but I think there must be a better way.

    I was using a global method to try to simplify the individual SceneDirector events:

    Sub setFirstKeyFrame(byref AnimControllerName as String, byref Scene as XpScene)


    '
    ' Sets the first keyframe of the animation to the current
    ' camera position.
    '
    dim anim as XpAnimController
    dim camera as XpBaseObject
    dim px, py, pz, rx, ry, rz as Double

    if Scene.getObjectByName("Camera", camera) then
    if Scene.getAnimControllerByName(AnimControllerName, anim) then
    camera.getPosXYZ(px, py, pz)
    camera.getRotXYZ(rx, ry, rz)
    anim.setKeyFrameValueTCB(camera, 0, "Position.X", px, 1.0, 0.0, 0.0)
    anim.setKeyFrameValueTCB(camera, 0, "Position.Y", py, 1.0, 0.0, 0.0)
    anim.setKeyFrameValueTCB(camera, 0, "Position.Z", pz, 1.0, 0.0, 0.0)
    anim.setKeyFrameValueTCB(camera, 0, "Rotation.X", rx, 1.0, 0.0, 0.0)
    anim.setKeyFrameValueTCB(camera, 0, "Rotation.Y", ry, 1.0, 0.0, 0.0)
    end if
    end if
    End Sub



    Then the event script would just be:

    setFirstKeyFrame("NameOfController", scene)



  • 2.  RE: "Animate to..." suggestions.

    Posted 03-02-2017 18:16
    Here is an example that I hope might help.. https://transfer.rossvideo.com/f/4400e3d6f
    This is a scoreboard where the lines of the scoreboard are datalinq'd, and each time the scene director is resumed it will animate the lines from their current position to a new sorted position.
    It dynamically builds the anim controller via a script and then triggers the anim controller to play. Note the anim controller isn't actually on the scene director (this might help you in your situation).

    Look on the main scenedirector of this example for the script (most of the logic in the script is to sort the scores).


    #XPression


  • 3.  RE: "Animate to..." suggestions.

    Posted 03-03-2017 01:31
    Thanks for the project example, Brian.

    I guess I'd like to just confirm that, even if an animation controller starts at frame 5, if you go to frame 0 on the scene director, the animation at frame 0 of the controller is actually evaluated before my script gets run. It seemed to work initially, but when I added the other six scene directors, it didn't. I also have a weird problem where just one of the animations shows that the final keyframe has a TCB of 1.0, 0.0, 0.0 (and the curves reflect what should be a soft landing), but it doesn't ease out at the end.

    While I'm on the subject, it seems to me that nothing really works to smooth animations except TCB with a tension of 1.0, but it may be my animations are too simple (just two keyframes total).
    #XPression