Interpolate 2 actors together

Jeffm2Jeffm2 Member, PRO Posts: 148

Hey all,

I am making an expanding menu. I have 2 actors (a long bar and menu open button) that need to interpolate their positions together. I have them interpolating to the same x position at the same rate. I even have the button x constrained to the bar x, but the button seems to bypass the bar slightly as they move. Any thoughts or is there a better way to do this? I have them as separate actors in order to add buttons to this bar and have a"click state" on the button.

Comments

  • bob loblawbob loblaw Member, PRO Posts: 793

    use a global attribute that’s set to 0.

    in your main button, have a rule that switches the global attribute between 0 and 1.

    in each of the expanding components, have local attributes that record the start position of the actor; and use a rule that says if the global attribute is 1, interpolate position to wherever. if the attribute is 0, interpolate to the start position.

  • Jeffm2Jeffm2 Member, PRO Posts: 148

    @bob loblaw Thank you so much for the response. Yup i have all that. I have a global rate, each component has a local start position variable that is their begging start position.

    Ive uploaded a screenshot of what happens. If you notice, the buttons seem to speed ahead of the bar just before they all end up in the same place.


  • bob loblawbob loblaw Member, PRO Posts: 793

    i can’t tell from that screen grab what you mean. are the menu buttons meant to slide out from the left when you press the icon above reset, with both those icons sliding right as well?

  • Jeffm2Jeffm2 Member, PRO Posts: 148

    so this a screen of the menu sliding from the left. the black bar is part of that as are the buttons, but the buttons move and "overtake" the black bar as you can see that they are coming off the side a bit as they seem to be moving faster. so yeah the menu and resetbuttons move with the black bar and actually the white blocks behind as well as that is all part of the menu.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    You have the elements as separate actors correct? One option would be to have the menu be just a single image that will slide on and off screen smoothly. Once the menu slides to its stopped position you could spawn 'invisible' actors over each button that would control their actions.

  • bob loblawbob loblaw Member, PRO Posts: 793

    so everything works except those two buttons?

    without knowing the exact logic you have in there, you may have just miscalculated your finish position in this actors.

    if you haven’t tried this, do what you stated above with the local variable, then in your interpolate for each, interpolate position.x to start+ the distance you want to move to when activate. interpolate position.x to start when switched off.

    option b is take out the interpolate behaviour in the button actors, unlock those actors, and in each, add a constrain behaviour that keeps their x position locked to an x position of the bar. they’ll all go to the same place then.

  • Jeffm2Jeffm2 Member, PRO Posts: 148

    ive done the constrain as well. they all go to the same place. the buttons get there slightly quicker. i may need to dowht @jamie_c suggests but now its like a pebble in my shoe. lol. i just feel it should work.

    I uploaded a video. https://youtu.be/vO-0glyA19c

  • bob loblawbob loblaw Member, PRO Posts: 793

    i see what you mean now. it looks like there’s a processing delay in the interpolation of this actors relative to the others.

    have you tried viewing in the gs app, or testing on a device with an ad hoc build to see if it does the same thing? also might be worth looking at how far apart each actor is in the scene hierarchy. if there’s too much going on in between the actors with the lag, maybe bringing them closer in the hierarchy might help? i’m just throwing things out there without having an exact solution to offer, hopefully it helps.

    gs does some weird stuff sometimes. in my current project i have display actors that constrain to a relative size and position to adjust for zoom. they work perfect on every scene except one where they jolt a little like in your scene. can’t figure out why as i made a scene template that i reused so far over 20 times, including the scene where i have the problem.


    *gs processes from the first actor in the lowest scene layer first.

  • Jeffm2Jeffm2 Member, PRO Posts: 148

    ill give changing the order a shot. I just feel like im taking crazy pills lol. The final output will be an HTML 5 learning module. I think there have been some good solutions posted here.


    THANK YOU SO MUCH FOR TAKING THE TIME. if i find something that fixes, I'll post here for the curious.

Sign In or Register to comment.