Closed dasha-5555-5 closed 8 years ago
Hi,
there are a few things we should check. First make sure there are no other transformations affecting the <view>
element that you're using, besides the one that the StandardCamera creates (which will be named something like Generated_Camera_Transform_0
). Best thing would be to put a view element right under the xml3d element and set it as the active view:
<xml3d view="#cameraView">
<view id="cameraView"></view>
...
</xml3d>
Next, if you're using camera.examine()
make sure the object that you want to examine is finished loading before you call that function, otherwise it could break the camera. I'll add a check for this to the next release. Best thing would be to use the load event on the mesh that you want to examine:
<mesh onload="initializeMyCamera(event)" src="myMesh.ctm"></mesh>
Or use the onload event on the <xml3d>
element which will fire when all the meshes and materials in the scene are done loading.
If all that checks out then see if you can link the scene with the CTM model here and I'll take a look at it.
Also, you can find the center of objects by getting their bounding box:
var bbox = document.getElementById("mymesh").getWorldBoundingBox();
var center = bbox.center();
Thanks! It really works!!
Cool, glad you got it working!
Hi! My mesh is in ctm format. I can't set examine point of my mesh and I don't know how to count the center of mass my mesh and rotate mesh around it's center. I already have testing many variants such as "var camera = new XML3D.StandardCamera(viewElem, {mode:"examine", useKeys: true})", "camera.examine(mesh);", also I followed by this examples: http://xml3d.github.io/xml3d-examples/examples/candle/candle.html, http://xml3d.github.io/xml3d.tools.js/cameracontrollers.xhtml, but in my case my model rotating in depends on camera view. Can anyone help me?