How do I add hot spots in a jsc3d model? -
i have 3d model loaded in web page using jsc3d. there way place hot spot (a clickable area) on model when clicked zoom in , rotate model specific set or coordinates?
i think "hotspot" mesh selection built in. let have correctly initialized viewer:
var viewer; /* set viewer options */ ... viewer.init(); ...
set callback function:
viewer.onmousedown = onviewermousedown;
then need this:
function onviewermousedown(x, y, button, depth, mesh) { if (button == 0/*left button down*/ && mesh != null) { var meshname = mesh.name; var pivot = mesh.aabb.center(); /* selected mesh */ console.log('mesh center: ' + json.stringify(pivot)); } }
if have more 1 mesh, should rotate/translate self, example implementing mesh rotation matrix in jsc3d prototype.
more info:
http://jsc3d.googlecode.com/svn/trunk/jsc3d/docs/symbols/jsc3d.viewer.html#onmousedown
Comments
Post a Comment