Skip to main content

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, BufferGeometryEventMap>, MeshBasicMaterial<MaterialEventMap>, Object3DEventMap>


shadowHeight​

• shadowHeight: number


boundingSize​

• Readonly boundingSize: Vector3


_stablePoses​

• Optional _stablePoses: { distance: number ; faceNormal: Vector3 ; area: number ; face: Face ; maxEdgeLength: number ; xform: Matrix4 ; edgePoint: Vector3 }[]

Inherited from​

Mesh._stablePoses


_poseIndex​

• Optional _poseIndex: number

Inherited from​

Mesh._poseIndex


_originalXform​

• Optional _originalXform: Matrix4

Inherited from​

Mesh._originalXform

Constructors​

constructor​

• new ARPlacementBox(boundingBox, camera, placeOnWall?)

Parameters​

NameTypeDefault value
boundingBoxBox3Bundefined
cameraCamera<Object3DEventMap>undefined
placeOnWallbooleanfalse

Overrides​

Mesh<BufferGeometry, MeshBasicMaterial\>.constructor

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​

NameType
sceneObject3D<Object3DEventMap>
screenXnumber
screenYnumber

Returns​

null | Vector3


getExpandedHit​

▸ getExpandedHit(scene, screenX, screenY): null | Vector3

Parameters​

NameType
sceneObject3D<Object3DEventMap>
screenXnumber
screenYnumber

Returns​

null | Vector3


updateOpacity​

▸ updateOpacity(delta): void

Call on each frame with the frame delta to fade the box.

Parameters​

NameType
deltanumber

Returns​

void


dispose​

▸ dispose(): void

Call this to clean up Three's cache when you remove the box.

Returns​

void

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

• 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​

NameType
offsetnumber

Returns​

void


show​

• get show(): boolean

Set the box's visibility; it will fade in and out.

Returns​

boolean

• set show(visible): void

Set the box's visibility; it will fade in and out.

Parameters​

NameType
visibleboolean

Returns​

void