edited January 2018 in ORK Support
Hallo everyone!
I would like to store the position of my custom camera as a "camera position" in ORK (World->camera position).
I guess this can be done via "Change game variables" in an event. Object should be set as "Actor", and Actor as "Camera", right?
However, I struggle with defining the variable i have to store those Vector3 values to. So, where does ORK store camera positions and how do I access one?
Thank you in advance!
Post edited by Kaiton on
  • You can't add any items to the ORK Framework Editor using Events.
    You'll want to add them manually.

    Try reading this and following the steps: http://orkframework.com/tutorial/howto/camera-positions/#creating_with_the_scene_wizard

    Basically you use the Scene Wizard to set up a "photo shoot" of a test object.
    Then you can save the settings to the Editor's index.

    The Event system is for runtime behavior.
    In this case, use a Change Camera Position step and you can choose on of your camera positions from a dropdown.
    Make sure in the Event Settings node you add at least one camera as an actor.
  • Hallo Klep, thank you for the answer.

    I know how to use the wizard for camera position creation, this however is not suited for my specific needs. I need to store and acess this information in game, real time.

    The values of every camera position must be acessible and modifiable authomatically via a script. And i would like to lern how.
  • I see.
    Could you describe exactly what you're trying to make?

    There a step that might help you: Value > Variable > Transform to Variable
    You need to use it twice when saving, reading or adjusting.
    Once for the position, once for the rotation.


    You'll want to use that at least once to create an ORK variable for your scripts to manipulate.

    From that point on the syntax you'll need for your script is:
    ORK.Game.Variables.GetVector3 ("variableKey");
    ORK.Game.Variables.Set ("variableKey",(x,y,x));

    Make sure you include:
    using ORKFramework;
    using ORKFramework.Behaviours;

    Let me know if you need more help or if I didn't understand you.

  • I have a custom camera.
    Battle uses a camera position.
    When the battle is over, i want to smoothly transit from this camera position to the position before the battle started.
    Saving the position of the camera before the battle in the "transform to variable" step is fine.
    Now i would like to use those values to set a new camera position, which i could use for "change camera position step" with smooth panning, and such.
    I have tried to that this way:
    Yet it does not hapen.

  • Okay.

    What you could do is use an empty game object to mark your camera's location at the beginning of the event.
    Just instantiate the object to where your camera is when battle starts.
    Then let the camera fade to the position needed by the battle.
    Then fade the camera back to the empty game object and destroy that object.

    Or you could still use 2 Global Variables with Transform to Variable nodes like we discussed before.

    A few observations about your image:

    The "Use Target Position" might not be what you want.
    It assumes that you want to use an object to move the camera, so it doesn't let you access the Camera Positions you set in World > Camera Positions.

    I don't think you want the Selected Data from the dropdown menu.
    Selected Data is only for things you explicitly save with a Selected Data step.
    But you don't really need that if you're going to reference an ORK Game Variable.
    Try using Actor instead and selecting the placeholder empty object.
    Don't forget to add the placeholder object as an actor in the Event Settings node.
  • For whatever reason, setting the global variable to the camera values did not work for me.
    However, thanx to Kleps explanation, i managed to achieve the goal.

    Battle start event:
    first step: "search object".
    Object Key -> Value Type (Value), Value ("Finder") //just a name for the variable
    Find Objects -> Search Type (Name), Search Name (Main camera)

    second step: "transform to variable".
    // just as Klep explained
    Origin Object -> Object (Found objects)
    Objects/selected key -> Value type (Value), Value ("Finder"), Value origin (Position)
    Variable settings -> Variable origin (Global)
    Variable key -> Value Type (Value), Value (CameraPositionSave)//just a name for the variable

    Same procedure for rotation, variable name changed to "CameraRotationSave".

    Battle end event:
    Spawned a prefab and set its position and rotation by the variables defined above.
    Made camera fade to the prefab position.

    Everything works fine, unless zoom is too far out before the battle starts. Then there is a little jerk of the camera in the end of the fading, when my following script is activated again. Probably due to rounding of the position values. But that's neglectable.

    Thank @Klep for help!
Sign In or Register to comment.