El ejemplo al que se vincula tiene una API simple para esto.
Pon esto en tu HTML. Tendrás que llamar al download the script y asegurarte de que se carga.
<script src='threex.domevent.js'></script>
Luego, en su objeto de malla, llamar al siguiente:
mesh.on('click', function()
{
// response to click...
mesh.scale.x *= 2;
});
O un ejemplo más interesante que anima la rotación y el color de un objeto sin problemas:
mesh.on('click', function(event)
{
var object3d = event.target,
rotation, color;
if (object3d.rotation.x < Math.PI/4) {
rotation = {x: Math.PI/2};
color = {r: 1, g: 0.5, b: 0};
} else {
rotation = {x: 0};
color = {r: 0.5, g: 0.75, b: 0.25};
}
new TWEEN.Tween(object3d.rotation)
.to(rotation, 800)
.easing(TWEEN.Easing.Bounce.EaseOut)
.start();
new TWEEN.Tween(object3d.material.color)
.to(color, 300)
.easing(TWEEN.Easing.Quartic.EaseIn)
.start();
})
http: // stackoverflow.com/questions/8292486/three-js-how-to-detect-what-shape-was-selected-after-drag – BorisD