xXx
xXx

Reputation: 1151

Hidding objects between specific object and camera in threejs

I am currently using three.js with multiple objects in the scene. I want to be able to select one object and then every object between the camera and the selected object is hidden or removed.

How could this be done?

Upvotes: 0

Views: 176

Answers (1)

manthrax
manthrax

Reputation: 5016

You select objects using the THREE.RayCaster. The raycaster returns ALL the objects under the cursor, in depth order.. so you can loop through the list of raycast hits and set all but the last one to .visible = false for instance.

Upvotes: 1

Related Questions