raycastObject

Returns a RayObjectHit of an object if intersected by the current mouse-cursor position, or the Ray if specified.

raycastObject(
	objectName: string,
	ray?: Ray
): Promise<RayObjectHit | null>

Parameters
Description
Type

objectName

The name of the object we want to get the intersection data from.

string

ray (optional)

A ray specifying how we should intersect with the objects.

Usage:

await modelApi.raycastObject('T-Shirt');

Return value:

{
    "id": "5a9510cf-fa29-4c8b-9804-6cf6df6b43ee",
    "name": "T-Shirt",
    "position": {
        "x": 37.350260811166834,
        "y": -120.26830756045021,
        "z": 363.7658504937014
    },
    "normal": {
        "x": -0.022361778356376052,
        "y": -0.9989480768854121,
        "z": -0.03996635577118709
    },
    "uv": {
        "x": 0.20498806490294819,
        "y": 0.2775749847073309,
        "z": 0
    }
}

Last updated