Graphics

 View Only
Expand all | Collapse all

Visual Logic - PosX Controlled by Visibility

Brian Ford

Brian Ford11-02-2015 15:54

Brian Ford

Brian Ford11-02-2015 16:10

Brian Ford

Brian Ford11-03-2015 01:12

  • 1.  Visual Logic - PosX Controlled by Visibility

    Posted 10-30-2015 19:56
    I'm brand new to Visual Logic (just installed version 5.7 from 5.0 two days ago), and I'm trying to build a scene where the PosX of one object is controlled by the visibility of another. I have two quads, one has the visibility published. If the user sets it as visible, I need the PosX of the *other* quad to change to 1500, but if it's not visible, to go back to it's natural home of 420.

    Any thoughts on how to do this in Visual Logic? I could script the daylights out of it, but I'm forcing myself to attempt to learn the new stuff.


  • 2.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 10-30-2015 19:59
    Hi Dan,

    Feed the visibility into a Selector Block. The visibilty basically becomes a 0 or 1, and is used to select one of the inputs of the selector block and feed it to the output of the selector. When the visibility is zero the first input of the selector will pass, and when the visibilty is 1 the second input of the selector will pass..

    Feed two constant X positions into the selector inputs, and connect the output of the selector to the Pos X property of what you are trying to control.

    #XPression


  • 3.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 15:48
    What do I use to feed the X positions into the selector inputs? String block? Two other objects with their PosX set accordingly?

    #XPression


  • 4.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 15:49
    In the Math category you will find a "value" block which is just a number..

    #XPression


  • 5.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 15:53
    Using that same thought, if I feed a 0 or 1 into a Visibility block, can I control visibility of that object?

    #XPression


  • 6.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 15:54
    Yes, that should work.

    #XPression


  • 7.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 15:56
    Awesome. The final piece I'd want to find out then:

    I've got one group that moves from the top left to the top right under certain conditions. I've got that working. Now, I need its visibility to be controlled by two different objects. If object A is visible, the group is visible with PosX of 420. If object B is visible, the group is visible with PosX of 1500. If neither A or B is visible, the group should not be visible at all.

    Ideas?

    #XPression


  • 8.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 16:07
    I'm assuming it doesn't matter what happens to the group when both A and B are visible, so this would be the simplest case that does what your statement says:



    #XPression


  • 9.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 16:09
    Are you able to post that on any site other than imgur? Due to its use on reddit and for un-HR-friendly sites, it is blocked at my station.

    #XPression


  • 10.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 16:10


  • 11.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 16:13
    And if both are visible, it should be visible, with PosX the higher value. Basically, this is a bug that sits on the left, unless there is another graphic being used, in which case it moves to the right. So it's "natural" state is not visible on the left. This can be changed to be made visible by itself.

    If the other graphic is visible, this should move to the right, and be visible (it will always be visible in this case). Some people don't remember this, and will turn the visibility of the group for the original "left-side" position. When this happens, it should be visible and on the right.

    #XPression


  • 12.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 16:17


    This worked perfectly. Thank you!

    As I said, I'm literally brand new to Visual Logic, and having scripted so much of this in the past, I'm stepping into a new world. Just trying to figure it all out.

    #XPression


  • 13.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-02-2015 17:10
    One more tweak I forgot. There's a third possibility: another object that when visible, the group should not be visible. This a different brand that gets used occasionally. So here's the function:

    if ObjA.Visible=True and ObjB.Visible=False then

    Group.Visible=True

    Group.PosX=420

    elseif ObjA.Visible=True and ObjB.Visible=True then

    Group.Visible=True

    Group.PosX=1500

    elseif ObjA.Visible=False and ObjB.Visible=True then

    Group.Visible=True

    Group.PosX=1500

    eslseif ObjC.Visible=True

    Group.Visible=False

    end if


    #XPression


  • 14.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-03-2015 01:12
    I think this is it:



    #XPression


  • 15.  RE: Visual Logic - PosX Controlled by Visibility

    Posted 11-03-2015 01:23
    Here is a hypothetical example if for example you wanted the group at a different X position based on whether A,B, or C were visible.. It's not what you are asking for, but I thought it's a good example of how to cascade the input selector blocks..



    #XPression