HDK Core API
Modules

@hiber3d/hdk-core

Table of contents

Type Aliases

Functions

Type Aliases

EulerRotation

EulerRotation: [X, Y, Z]

Euler rotation angles.

See

https://en.wikipedia.org/wiki/Euler_angles (opens in a new tab)


LiteralUnion

LiteralUnion<T, U>: T | U & Record<never, never>

Type that allows a literal (i.e. string) but keeps autosuggest https://github.com/Microsoft/TypeScript/issues/29729 (opens in a new tab)

Type parameters

Name
T
U

QuaternionRotation

QuaternionRotation: [X, Y, Z, W]

Quaternion rotation.

See


Skeleton

Skeleton: AvatarSkeleton

Deprecated

Use AvatarSkeleton instead.


Vec3

Vec3: [number, number, number]

A three-dimensional vector.


Vec4

Vec4: [number, number, number, number]

A four-dimensional vector.


W

W: number

Represents a rotation on the W axis.


X

X: number

Represents a rotation or distance on the X axis to the right of the origin.


Y

Y: number

Represents a rotation or distance on the Y axis, upwards from the origin.


Z

Z: number

Represents a rotation or distance on the Z axis, inwards from the origin.

Functions

eulerToQuaternion

eulerToQuaternion(euler, quad?): QuaternionRotation

Converts a rotation represented in Euler angles to a rotation represented as a Quaternion GlMatrix quaternion (opens in a new tab)

Parameters

NameTypeDescription
eulerEulerRotationInput Euler angles - [x, y, z] Vec3
quad?QuaternionRotationoptional Quaternion representation to be used as target - [x, y, z, w] Vec4

Returns

QuaternionRotation

Quaternion representation - [x, y, z, w] Vec4


getAvatarDirection

getAvatarDirection(): Vec3

Returns

Vec3

the current direction of the avatar on the level


getAvatarPosition

getAvatarPosition(): Vec3

Returns

Vec3

the current position of the avatar on the level


printAssets

printAssets(): void

Outputting blockJSON

yarn build && node -e 'import("./dist/index.js").then(module => {module.printAssets(); process.exit(0);})' > src/generated/assets.json

Returns

void


quaternionToEuler

quaternionToEuler(quat, euler?): Vec3

Returns an euler angle representation (pitch-yaw-roll) of a quaternion

Parameters

NameTypeDescription
quatVec4Quaternion representation - [x, y, z, w] Vec4
euler?Vec3optional euler to be used as target - [x, y, z] Vec3

Returns

Vec3

Euler angles representation - [x, y, z] EulerRotation


setAvatar

setAvatar(id): void

This sets the avatar for the player using one of Hiber's own avatars

Parameters

NameTypeDescription
idAvatarIdid for a Hiber avatar to be equipped

Returns

void


setAvatarUrl

setAvatarUrl(url, provider): void

This sets the player avatar from an external provider

Parameters

NameTypeDescription
urlstringurl to the .glb file
providerstringprovider of the avatar

Returns

void


setMovementMode

setMovementMode(mode): void

This sets the player movement mode

Parameters

NameTypeDescription
modeMovementTypethe mode of the player movement to, i.e. 'fly' or 'walk'

Returns

void