Nicky
Nicky

Reputation: 3817

Three.js - How to select light / camera

Question,

In this editor, it is possible to select a light or camera by clicking on it. I know how to get this working for meshes (raycaster.intersectObjects(objects)), but since lights and camera's do not have meshes, how would I go about selecting such objects on click?

My thoughs were to implement some kind of box around it (say, a "picker") that is able to be hit by the raycaster by means of an invisible mesh?

Any thoughts or references on this?
Thank!

NOTE: Answer written in TypeScript is preferred, but JavaScript is fine too!

Upvotes: 1

Views: 209

Answers (1)

Mr_Pouet
Mr_Pouet

Reputation: 4290

You should definitely go with the invisible mesh solution. Simply set the visible property of your material to false and that will do the trick.

http://threejs.org/docs/#Reference/Materials/Material

Upvotes: 1

Related Questions