Rotating an object

I’m trying to rotate my 3d object. So far, it rotates in the way I want when the cursor is moving over the scene. However, I want to enable this functionality only when the mouse button is clicked.

Live GitRepo:

Sounds like you have a problem with interaction management and not 3d / mathematical rotations? It’s quite a lot of code in that repo to go over. Could you post a snipped of what you are having trouble with here?

Thanks for your reply! I have a function handleSelection (line 476) with the code to handle the rotation. chair.rotation.z = 180 * mouse.x
chair.rotation.x = 180 * mouse.y

around line 331 i’m trying to implement an if clause to say ‘if object is not selected, rotate. if object is selected, translate. else do nothing’.

You appear to have your conditional written: if - else - else if… It should be if - else if - else

if(myVar==='this'){
    thisFunc();
}else if(myVar==='that'){
    thatFunc();
}else{
    otherFunc();
};