Java Script and 3D model

Greetings and good afternoon, thanks to the manual I know that it is possible to modify an element, since it can be declared as an object and modify properties such as: top(number) , left(Number) , rotate(degree), etc.

Is it possible to adjust camera parameters and switch between scenes in a 3D model with Java script?

var obj = prez.object(“model”);
obj.top(15);
obj.rotate(30);

/// functions
obj.escene(1);
obj.camera.positionx(1.500);
obj.modelrotation.x(15);

Saludos y muy buen tarde gracias al manual se que es posible modificar un elemento, pues se puede declarar como un objeto y modificar propiedades como: top(number) , left(Number) , rotate(degree), etc.

¿Es posible ajustar los parámetros de la cámara y cambiar entre la escenas en un modelo 3D con Java script?

var obj = prez.object(“model”);
obj.top(15);
obj.rotate(30);

/// funciones para modificar parametros
obj.escene(1);
obj.camera.positionx(1.500);
obj.modelrotation.x(15);

1 Like

@Fabian_Vazquez
The short answer is “YES” you can manipulate the 3D objects with JavaScript

In the case of your camera position - I might craft the JavaScript this way.

prez.object("objName").camera.rotation.z = 180;

Unfortunately, I do not know all the options or have a reference on this other than lots of trial and error testing things with the console which is how I discovered the code above.

Perhaps in a response from the staff - they will have a more complete resource.
On a side note - it took me a while to get my hands on a 3D file and do some testing. I really like the possibilities it could bring us.

Thank you very much! It helps me a lot to take as a starting point because I was able to rotate and scale the model from JS.
Apparently three parameters can be modified, the general light, the camera and the model.

For the model
The rotation parameter is in radians. 0 = 0°, 6.28 = 360°

prez.object("model").scene.children[2].rotation.x;
prez.object("model").scene.children[2].rotation.y;
prez.object("model").scene.children[2].rotation.z;

Escale 0 to 1

prez.object("model").scene.children[2].scale.x;
prez.object("model").scene.children[2].scale.y;
prez.object("model").scene.children[2].scale.z;

I keep trying to see if it is possible to find more properties that may be useful