Class: Three::Raycaster
- Inherits:
-
Object
- Object
- Three::Raycaster
- Defined in:
- lib/three/core/raycaster.rb
Defined Under Namespace
Classes: Intersection
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#handle ⇒ Object
readonly
Returns the value of attribute handle.
Instance Method Summary collapse
-
#initialize(backend: Backends::ThreeJS.new) ⇒ Raycaster
constructor
A new instance of Raycaster.
- #intersect_object(object, recursive: false) ⇒ Object
- #intersect_objects(objects, recursive: false) ⇒ Object
- #set_from_camera(coords, camera) ⇒ Object
Constructor Details
Instance Attribute Details
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
25 26 27 |
# File 'lib/three/core/raycaster.rb', line 25 def backend @backend end |
#handle ⇒ Object (readonly)
Returns the value of attribute handle.
25 26 27 |
# File 'lib/three/core/raycaster.rb', line 25 def handle @handle end |
Instance Method Details
#intersect_object(object, recursive: false) ⇒ Object
37 38 39 |
# File 'lib/three/core/raycaster.rb', line 37 def intersect_object(object, recursive: false) intersect_objects([object], recursive: recursive) end |
#intersect_objects(objects, recursive: false) ⇒ Object
41 42 43 44 45 |
# File 'lib/three/core/raycaster.rb', line 41 def intersect_objects(objects, recursive: false) @backend.intersect_objects(@handle, objects, recursive: recursive).map do |entry| build_intersection(entry) end end |
#set_from_camera(coords, camera) ⇒ Object
32 33 34 35 |
# File 'lib/three/core/raycaster.rb', line 32 def set_from_camera(coords, camera) @backend.set_raycaster_from_camera(@handle, coerce_vector2(coords), camera) self end |