Graphics

 View Only
  • 1.  Scripting Help - Position and Animation Controller

    Posted 06-02-2020 03:09

    Hi, I am trying to make a scene be dynamic as possible.  I have the below script on a text object in my scene.

    The script is working to set the width of my quad correctly.  Now I am trying to do 2 more things.  I want to set the position of a text box based on the one text.  That is what T1 is.  Then I would like to change the speed of the animation controller, that is what the 1000 is attempting to do.  I did not know what that value needed to be set at.

    The speed is variable.  I could have something last 30 minutes 108,000 frames, but say it is 10 minutes, I need the text = 10 then p1.speed = xxxxxx? in order to make the animation controller play out 35,640 frames.

    dim FS1, FS2, FS3 as xpQuadObject
    dim FS1t, FS2t, FS3t as xpQuadObject
    dim T1 as xpTextObject
    dim P1, P2, P3 as xpAnimController


    scene.GetObjectByName("First Skill Total Time", FS1)
    scene.GetObjectByName("First Skill Time Elapsed", FS1t)
    scene.GetAnimControllerByName("Player1", P1)
    scene.GetObjectName("Skill 1 Text", T1)


    scene.GetObjectByName("Second Skill Total Time", FS2)
    scene.GetObjectByName("Second Skill Time Elapsed", FS2t)
    scene.GetAnimControllerByName("Player1", P2)

    scene.GetObjectByName("Third Skill Total Time", FS3)
    scene.GetObjectByName("Third Skill Time Elapsed", FS3t)
    scene.GetAnimControllerByName("Player3", P3)


    if text = "15" then
    FS1.SetSize (800, 12)
    FS1t.SetSize (800, 12)
    T1.PosX = 0
    P1.Speed = (1000)

    elseif text = "20" then
    FS1.SetSize (1286, 12)
    FS1t.SetSize (1286, 12)

    elseif text = "25" then
    FS1.SetSize (1590, 12)
    FS1t.SetSize (1590, 12)
    end if


  • 2.  RE: Scripting Help - Position and Animation Controller

    Posted 06-14-2020 02:14

    Hi Garrett,

    For the first part of your question I used Visual Logic to solve it.

    Selecting which size to use for a quad is quite simple with an Input Selector. The only difficulty is that you need to specify whether it's option 1, 2 or 3.

    Now to do that I'm using some conditions to determine which value the text is. These conditions will only return 0 or 1. So I need to convert those values into 1, 2 or 3 so that's why I'm multiplying them by 1, 2 or 3.

    The next problem is that I can only enter 1 value into the Input Selector. So I'm adding all my values together to get a single value. And only one of those conditions can be true, only one will output a 1 and the others will be 0. So after the addition I will get a 1, 2 or 3. If the text isn't any of those values, I will get a 0 which will not trigger anything.

    Then in my Input Selector I have assigned the different widths to the different inputs.

    Now for the second part of your question.

    To be honest it's quite hard to understand what you're trying to accomplish.

    So if I understand correctly, you have an animation which has a duration of 108,000 frames. If you have a value of 10, you want to speed up the playback so that all 108,000 frames are being played in 10 minutes? And if you set it to a value of 20, the playback should be set so that the entire animation is being played in 20 minutes?

    Is this what you are trying to do?

    If so, unfortunately we can't control the playback speed from the Visual Logic. So we have to use scripting for this one.

    So as you said in your question, you can set the speed of the animation by using

    animControllerName.Speed = 1


    The value of 1 means it will playback at the normal speed. If you use 2 it will play back at double the speed, 3 is triple the speed etc...

    If you want half the speed you can use 0.5.

     

    If you don't want to use scripting, you could use Visual Logic to trigger specific Scene Directors. But then you would need multiple Scene Directors. One which will play at the normal speed, one which will play at double the speed and one at triple the speed. You will need to put an event on the first frame to indicate at which speed that Scene Director will have to play.

    Best regards,

    Ken

     


    #XPression