Class: ARPlacementBox
Extra-Helpers.ARPlacementBox
This class is a set of two coincident planes. The first is just a cute box outline with rounded corners and damped opacity to indicate the floor extents of a scene. It is purposely larger than the scene's bounding box by RADIUS on all sides so that small scenes are still visible / selectable. Its center is actually carved out by vertices to ensure its fragment shader doesn't add much time.
The child plane is a simple plane with the same extents for use in hit testing (translation is triggered when the touch hits the plane, rotation otherwise).
Hierarchy
Mesh
<BufferGeometry
,MeshBasicMaterial
>↳
ARPlacementBox
Properties
hitPlane
• hitPlane: Mesh
<BufferGeometry
<NormalBufferAttributes
, Event
, string
>, MeshBasicMaterial
<Event
, string
>>
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:104
shadowHeight
• shadowHeight: number
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:105
boundingSize
• Readonly
boundingSize: Vector3
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:106
Constructors
constructor
• new ARPlacementBox(boundingBox
, camera
, placeOnWall?
)
Parameters
Name | Type | Default value |
---|---|---|
boundingBox | Box3B | undefined |
camera | Camera <Event , string > | undefined |
placeOnWall | boolean | false |
Overrides
Mesh<BufferGeometry, MeshBasicMaterial\>.constructor
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:113
Methods
getHit
▸ getHit(scene
, screenX
, screenY
): null
| Vector3
Get the world hit position if the touch coordinates hit the box, and null otherwise. Pass the scene in to get access to its raycaster.
Parameters
Name | Type |
---|---|
scene | Object3D <Event , string > |
screenX | number |
screenY | number |
Returns
null
| Vector3
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:157
getExpandedHit
▸ getExpandedHit(scene
, screenX
, screenY
): null
| Vector3
Parameters
Name | Type |
---|---|
scene | Object3D <Event , string > |
screenX | number |
screenY | number |
Returns
null
| Vector3
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:165
updateOpacity
▸ updateOpacity(delta
): void
Call on each frame with the frame delta to fade the box.
Parameters
Name | Type |
---|---|
delta | number |
Returns
void
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:210
dispose
▸ dispose(): void
Call this to clean up Three's cache when you remove the box.
Returns
void
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:219
Accessors
offsetHeight
• get
offsetHeight(): number
Offset the height of the box relative to the bottom of the scene. Positive is up, so generally only negative values are used.
Returns
number
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:186
• set
offsetHeight(offset
): void
Offset the height of the box relative to the bottom of the scene. Positive is up, so generally only negative values are used.
Parameters
Name | Type |
---|---|
offset | number |
Returns
void
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:177
show
• get
show(): boolean
Set the box's visibility; it will fade in and out.
Returns
boolean
Defined in
webgi/src/extras/webxr/arPlacementBox.ts:203
• set
show(visible
): void
Set the box's visibility; it will fade in and out.
Parameters
Name | Type |
---|---|
visible | boolean |
Returns
void