Skip to main content

Event

Provided to event callbacks such as onHoverEnter, onHoverLeave, onPointerDown and onPointerUp with information about the event.

import React from "react";

export default function App() {
return (
<app>
<box
onPointerDown={(e) => {
console.log(e.type)
console.log(e.hit.normal)
}}
/>
</app>
);
}

Props

PropTypeDescription
typeStringhover-enter, hover-leave, pointer-down or pointer-up
avatarUidStringUID of the avatar that produced the event
avatarAvatarThe avatar that produced the event
handStringThe hand that produced the event. null when not in VR
originVector3The origin of the raycast in world space
directionVector3The direction of the raycast in world space
hitHitThe entity that was hit (if any)

Hit

PropTypeDescription
entityUidStringThe UID of the entity
pointVector3The position of the hit in world space
normalVector3The The normal of the hit, in world space
distanceNumberThe distance from origin to the hit point
meshNameStringThe name of the mesh, if any
nodeIdStringThe ID prop of the node/element
instanceIdNumberThe index of an individual <boxes/> or <spheres/> item
isAvatarBooleanWhether the entity hit is an avatar

Notes

None