aframe Raycasters (component)

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

The raycaster component does general intersection testing with a raycaster. Raycasting is the method of extending a line from an origin towards a direction, and checking whether that line intersects with other entites. The raycaster component is a wrapper on top of the three.js raycaster. It checks for intersections at a certain interval against a list of objects, and will emit events on the entity when it detects intersections or clearing of intersections (i.e., when the raycaster is no longer

Parameters

ParameterDetails
farMaximum distance under which resulting entities are returned. Cannot be lower then near.
intervalNumber of milliseconds to wait in between each intersection test. Lower number is better for faster updates. Higher number is better for performance.
nearMinimum distance over which resuilting entities are returned. Cannot be lower than 0.
objectsQuery selector to pick which objects to test for intersection. If not specified, all entities will be tested.
recursiveChecks all children of objects if set. Else only checks intersections with root objects.

Remarks

Events

NameDetails
raycaster-intersectedEmitted on the intersected entity. Entity is intersecting with a raycaster. Event detail will contain el, the raycasting entity, and intersection, an object containing detailed data about the intersection.
raycaster-intersected-clearedEmitted on the intersected entity. Entity is no longer intersecting with a raycaster. Event detail will contain el, the raycasting entity.
raycaster-intersectionEmitted on the raycasting entity. Raycaster is intersecting with one or more entities. Event detail will contain els, an array with the intersected entities, and intersections, an array of objects containing detailed data about the intersections.
raycaster-intersection-clearedEmitted on the raycasting entity. Raycaster is no longer intersecting with an entity. Event detail will contain el, the formerly intersected entity.

Member

MemberDescription
intersectedElsEntities currently intersecting the raycaster.
objectsthree.js objects to test for intersections. Will be scene.children if not objects property is not specified.
raycasterthree.js raycaster object.

Methode

MethodDescription
refreshObjectsRefreshes the list of objects based off of the objects property to test for intersection.


Got any aframe Question?