Scrolling camera (vertically) to object/position

  • #1, by F_KalThursday, 23. February 2017, 05:45 3 years ago
    I have difficulty making my "camera" scroll and center at an object that is over my character. 

    In particular I am trying to make my character look at an object hanging from the ceiling that is partially outside the view (the image is H:1901xW:2969). I have tried both Scroll to Object and Scroll to position, but no luck. I tried unlocking the camera from the character (by ticking the Clear centering on the Center Scene on Character Permanently) but no luck!
    I tried shortening the image from 1901 down to 1500 but it still didn't work. Any ideas what could be the issue?

    Thank you

    Forum Fan

    107 Posts


  • #2, by afrlmeThursday, 23. February 2017, 12:29 3 years ago
    Scroll to object is actually scrolling to the object position you defined for the object. Basically it's the position in which the character should stand to interact with the object rather than the position of the objects image sprite / animation.

    Please note that scroll position is  based on the top left pixel of the current viewport, so setting x = 0, y = 0 would be the top left most part of the scene. The max x, y you can scroll the camera is scene width - game default resolution width & scene height - game default resolution height, so...

    scene width = 2969
    scene height = 1901

    game default resolution = 1920x1080

    scene width - 1920 = 1049
    scene height - 1080 = 821

    Could you snap a screenshot of what it looks like & what you would like it to look like please?

    Imperator

    6842 Posts

  • #3, by F_KalThursday, 23. February 2017, 14:33 3 years ago
    thanks @AFRLme, once again you saved the day! You found my issue - it's now solved!

    (for reference)
    - The object I'm trying to "look at" is outside the waysystem (since it's hanging from the roof) so from what you explaind scroll to object wouldn't work.

    - Scroll to Position on the other hand does work: Now that I manually tested the 0,0 coordinates it worked just fine! The problem was that I was using the small "set position" icon to set the crosshair on the ceiling fixture.  But apparently (as you mentioned) it should be referring to the top-left corner of the target viewport and not the center of the object!

    I've attached two images: My character was already at the rightmost part of the screen, so the camera wouldn't scroll any further, now all is well!


    Forum Fan

    107 Posts

  • #4, by afrlmeThursday, 23. February 2017, 15:10 3 years ago
    No problem. wink

    I forgot to mention that centering anything is basically done by figuring out the coordinate of what you want to center on & then subtracting 50% of default game resolution from both x & y. Visionaire Studio doesn't allow the camera to be scrolled outside of the scene background so any negative value coordinates or coordinate values that would push camera too far down or across will automatically be adjusted (or ignored).

    P.S: by viewport I am talking about the part of scene you can currently see - as in what the camera is showing. I don't know if that is the correct term. Simon uses that term for the openGL shader in which some of the functions allow you to reposition the camera around the scene, rotate the camera & zoom in/out. Panning with the openGL shader can be more dynamic but there's no safeguards in place to prevent the camera from going past the scene background. You have to script those yourself.

    Imperator

    6842 Posts

  • #5, by F_KalThursday, 23. February 2017, 20:18 3 years ago
    Yes, thank you AFRLme!

    Forum Fan

    107 Posts

Write post