How to OrbitControls only over object and not on entire Canvas?

Okay I have been researching about this all morning…

How to limit the mouse and touch controls only when the mouse/finger is on the object. Right now the entire canvas is available for interaction.

I can use raycaster to detect if the mouse is over the object then pass it on to controls.

However I have no idea how CPU intensive it would be.

Any pointers are much appreciates.

DragControls also performs raycasting in order to determine selected objects. I would give it a go and see how it performs.

You could probably just use the enabled property on the OrbitController and update it in the part where you check for the intersection.
https://jsfiddle.net/amitlzkpa/hjrzbqu4/

Don’t think it’d be much more expensive since most of the checks are already done?

1 Like

@amitlzkpa Brilliant mate! You are a life saver…

Yes @Mugen87 I was planning for a custom implementation of object rotation instead of camera.

Many thanks for your continued support. I am almost there to post my starter project under Showcase :wink: