I have some issues about my model. Is is an easy model buy I can not make It work well…
I upload my project here: http://webgl.drapps.info
I have a car model with some pieces that change material when mouse is over them. I use threex.domevent.js library with “on” function. My model is loaded by json files.
Issue 1
when mouse is out of canvas, threejs detects that mouse is over a piece of my model, but this is not true, and that piece change its material (triggering mouseOver event).
Furthermore, I tried to get better mouseover event because even when mouse is really over a piece, that event doesn’t trigger.
Issue 2
This is about TrackballControls. Is there any way to control rotation of my world? I mean: rotation only in one axis, rotation only for 180 degrees, etc… Is there any tutorial or article to learn how to rotate and translate camera?
Thanks for everything, I will so please to anybody who wants answer this… because I am a little lost
Thanks
Sorry, but you are out of luck.
Question 1. Yikes! You are using
threex.jswhich is a third-party app that hasn’t been updated in almost a year, so I can’t help you with that.You are also using an older version of
three.js. Please update to the current version.If you still have problems, post a new question with a simple demo — not your entire project. Better yet, Google your question first.
Question 2.
TrackballControlsis not part of the library — it is part of the examples — so it is not officially supported. If you are not happy with it, you will have to hack the code yourself.This question has come up a lot. Google it. To the best of my knowledge, there is not a good solution.
Personally, I would use
OrbitControlsin your case — it keeps the scene right-side-up, and you can constrain the maximum polar angle, keeping the camera “above ground”.The best examples/tutorials are the official
three.jsexamples, which will work with the current version of the library.