Closed lensbreak closed 1 week ago
Actually you need only one line:
scene.activeCamera.autoRotationBehavior.idleRotationSpeed = 5
Example - https://codepen.io/eldinor/pen/VwOoqmN
I am not sure that I understand what you are doing but first thing you need is the Viewer instance. So be sure that you load the script into the head section of the page. Then on the page find the Viewer with JS, as written here - https://doc.babylonjs.com/features/featuresDeepDive/babylonViewer/advancedViewerUsage#finding-the-babylon-engine-scene-and-camera
The working example is here https://codepen.io/eldinor/pen/VwOoqmN
Let me know if you will have any questions. Since this question relates to the Viewer and not to the Wordpress plugin, it is better to ask it at Babylon Forum - https://forum.babylonjs.com/
Also note that all the examples from your code and my answer relate to the OLD Viewer version while this plugin uses the NEW Viewer version (v2). So if you want to use this plugin refer to its documentation and links as in this repo. If you want to use the 'old' version please download it here - https://github.com/eldinor/babylon-wordpress-plugin - and use according its documentation.
For the Viewer v2 the example is here - https://codepen.io/eldinor/pen/KKOBNOJ
For the Viewer v2 the example is here - https://codepen.io/eldinor/pen/KKOBNOJ
@eldinor Sorry but it seems your framework has quite some bugs. It randomly even not showing the main model, kinda frustrating. Also your example with the new verison does not have autoplay working? I checked it in 3 different browsers, your settings with viewerDetails.scene.activeCamera.autoRotationBehavior.idleRotationSpeed = 5 does not work, open your example and see yourself: https://codepen.io/eldinor/pen/KKOBNOJ
So again, how can I display 3d models (with or without wordpress plugin) of models and have them spinning 360 degree (faster than the default)?
Btw, is there also a bug in the MIME Type Declaration?
Should be like this:
if ( 'glb' === $wp_file_type['ext'] ) { $data['ext'] = 'glb'; $data['type'] = 'model/gltf-binary'; }
Btw, is there also a bug in the MIME Type Declaration?
Should be like this:
if ( 'glb' === $wp_file_type['ext'] ) { $data['ext'] = 'glb'; $data['type'] = 'model/gltf-binary'; }
Thanks, the typo corrected :) - https://github.com/eldinor/babylon-viewer-wordpress-plugin/commit/f730dcec48c488a475f7c0a662e63f0ae37c4b61
your framework has quite some bugs. It randomly even not showing the main model, kinda frustrating.
Please report all bugs related to the Babylon.js at Babylon forum - https://forum.babylonjs.com/
Also your example with the new verison does not have autoplay working? Yes, in the latest Babylon Viewer v2 autorotation is disabled by default now, and there were some changes in the Viewer. Refer to Babylon API at the moment, maybe later I'll provide the codepen example.
Here is the example with Viewer v2 Babylon.js v7.32.5 - https://codepen.io/eldinor/pen/wvVYwxJ
The link to the Viewer v2 - https://cdn.jsdelivr.net/npm/@babylonjs/viewer@7.32.5-alpha/dist/babylon-viewer.esm.min.js
Here is the example with Viewer v2 Babylon.js v7.32.5 - https://codepen.io/eldinor/pen/wvVYwxJ
The link to the Viewer v2 - https://cdn.jsdelivr.net/npm/@babylonjs/viewer@7.32.5-alpha/dist/babylon-viewer.esm.min.js
Thank you a lot, with the new example i finally managed to incluide the models in the online store.
Last question: How could I increase the global illumination / exposure a little bit (with or without a env file) since the model is a bit too dark in some parts (details are lost)?
viewerDetails.scene.getLightByName("defaultLight").intensity = 4.5
(default = 1)
Example - https://codepen.io/eldinor/pen/yLmRLKr
Also, there are other scene parameters like environmentIntensity, contrast and exposure, tonemapping etc - see Scene API at https://doc.babylonjs.com/typedoc/classes/BABYLON.Scene
I had tried with
viewerDetails.scene.environmentIntensity = 1.5;
but it is not applied for some reason.
Thanks for your solution. viewerDetails.scene.getLightByName("defaultLight").intensity = 4.5 works but looking at the object from the bottom its still too dark. i assume environmentIntensity would be better suited.
For example, you may try
viewerDetails.scene.imageProcessingConfiguration.contrast = 1 viewerDetails.scene.imageProcessingConfiguration.exposure = 4
And also add .env texture as in example - https://codepen.io/eldinor/pen/ExqdjWe
Hi
Im trying to change the speed of the autoRotation but it seems nothing works. How can I make the model spin quite fast from the beginning on?
I also tried to integrate the babylonjs manually but nothing works. Can you see what Im doing wrong?
functions.php:
HTML: