We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Programmatically changing camera parameters

Home Forums Programming Programmatically changing camera parameters

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #11853
    novator83
    Customer

    Hello, may I say firstly, this application is simply the best!!!

    I’m testing 3ds MAX version and I’m interested if it is possible to programmatically set/change parameters (as this is not possible with puzzles?) for current camera and call that function with JS function puzzle in specific moment?

    I would like to change parameters like “Min Distance”, “Max Distance”, “Min Vertical Angle”, “Max Vertical Angle”,… on some event.

    #11869

    Hello,

    yes, this is possible with JavaScript
    https://www.soft8soft.com/docs/api/en/controls/OrbitControls.html

    Chief 3D Verger | LinkedIn | Twitter

    #11997
    novator83
    Customer

    Thank You very much for directions! :good:

    I’m trying, but simply can not figure out how to control camera parameters. I’m novice in coding.

    I know how to work with existing camera as an object:
    var object = app.scene.getObjectByName(‘Box001’);
    var camera = app.scene.getObjectByName(‘Camera001’);

    object.rotateZ(0.1);
    camera.position.set(0, 20, 100);
    etc… that works!

    But how to change OrbitControls?
    var controls = new v3d.OrbitControls(camera); —> turns window in to black :wacko: Do I have to “select” an exiting OrbitControls here?

    controls.maxAzimuthAngle = 2;
    controls.minAzimuthAngle.set = 3;
    controls.update();

    #12004

    That OrbitControls object is automatically created and can be accessed through the App instance:

    app.controls

    Chief 3D Verger | LinkedIn | Twitter

    #12008
    novator83
    Customer

    Thank You! It works now! :yahoo:
    Best software, best support, I’m buying it as soon as I collect enough money!

    #12015
    elk
    Customer

    Sorry for hogging the thread, but how would i access the app from the browser developer console. I thought I could get at it from just typing “app” but i guess the OOP-ish stuff in JavaScript is confusing me a bit here os something …. I find it really useful to quickly test things out there compared to running the whole app over and over while testing things.

    #12016
    novator83
    Customer

    If You use Chrome, Vivaldi, Opera by pressing F12 or Control+Shift+J on keyboard if I understand you correctly?

    #12020
    elk
    Customer

    Yeah. I get that far, but if i type app.controls or even just app in the console there it gives me a “not defined” error. I use it to debug javascript on my own scripts, i am just having a hard time getting access to the app, but i think it might be a scope issue, and I really need to brush up on my “OOP” skills regarding JavaScript. But thanks for the sugestion :)

    #12022

    if i type app.controls or even just app in the console there it gives me a “not defined” error

    Yep, the app variable is not globally exposed. But you can add

    window.app = app;

    to the runCode function and it’ll get exposed.

    Chief 3D Verger | LinkedIn | Twitter

    #12023
    elk
    Customer

    Ahh. Will check that out. Should probably have been able to figure that out myself, but thank you so much Yuri :good:

    EDIT: Worked like a charm, thanks :D

    #12054
    novator83
    Customer

    Very useful. Thanks! B-)

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.