Home › Forums › Programming › Programmatically changing camera parameters
- This topic has 10 replies, 3 voices, and was last updated 5 years, 8 months ago by novator83.
-
AuthorPosts
-
2019-02-26 at 6:44 pm #11853novator83Customer
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.
2019-02-27 at 7:47 am #11869Yuri KovelenovStaffHello,
yes, this is possible with JavaScript
https://www.soft8soft.com/docs/api/en/controls/OrbitControls.html2019-03-01 at 8:23 am #11997novator83CustomerThank You very much for directions!
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 Do I have to “select” an exiting OrbitControls here?controls.maxAzimuthAngle = 2;
controls.minAzimuthAngle.set = 3;
controls.update();2019-03-01 at 9:58 am #12004Yuri KovelenovStaff2019-03-01 at 10:54 am #12008novator83CustomerThank You! It works now!
Best software, best support, I’m buying it as soon as I collect enough money!2019-03-01 at 12:06 pm #12015elkCustomerSorry 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.
2019-03-01 at 12:22 pm #12016novator83CustomerIf You use Chrome, Vivaldi, Opera by pressing F12 or Control+Shift+J on keyboard if I understand you correctly?
2019-03-01 at 1:04 pm #12020elkCustomerYeah. 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 :)
2019-03-01 at 1:09 pm #12022Yuri KovelenovStaffif 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.
2019-03-01 at 1:11 pm #12023elkCustomerAhh. Will check that out. Should probably have been able to figure that out myself, but thank you so much Yuri
EDIT: Worked like a charm, thanks :D
2019-03-01 at 4:22 pm #12054novator83CustomerVery useful. Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.