React Core API
Modules

@hiber3d/hdk-react

Table of contents

Type Aliases

Functions

Animations

Animation

Animation(animation): HDK React Component

Makes children animate.

Parameters

NameType
animationAnimationValues & AnimationOptions & { steps?: number[]; easing?: common.EasingType }

Returns

HDK React Component

See

Assets

AssetIDOptions

AssetIDOptions: Object

Used to specify the id of the skybox, reflection box and light box assets for an Environment.

Type declaration

NameType
lightboxID?LiteralUnion<CubeMapID, string>
reflectionboxID?LiteralUnion<CubeMapID, string>
skyboxID?LiteralUnion<CubeMapID, string>

BloomOptions

BloomOptions: Object

Options for bloom effects in an Environment.

Type declaration

NameType
blendAlpha?number
brightThreshold?number

ColorGradingOptions

ColorGradingOptions: Object

Color grading configuration options for an Environment.

Type declaration

NameType
brightness?number
contrast?number
hue?number
saturation?number
tintBlue?float3
tintGreen?float3
tintRed?float3

CubeMapFace

CubeMapFace: Object

Configuration for a face of a cubemap texture.

Type declaration

NameType
urlstring

CubeMapOptions

CubeMapOptions: Object

Specifies the URLs for the six faces of a cubemap texture.

Type declaration

NameType
backCubeMapFace
bottomCubeMapFace
frontCubeMapFace
leftCubeMapFace
rightCubeMapFace
topCubeMapFace

FogOptions

FogOptions: Object

Configuration options for fog effects in an Environment.

Type declaration

NameType
color?Color
density?number
height?number
invert?boolean
skyboxAlpha?number
skyboxGradient?number

SunOptions

SunOptions: Object

Represents options for configuring the sun in an Environment.

Type declaration

NameType
color?Color
exposureLuminanceAvg?number
position?Vec3
strength?number

WeatherOptions

WeatherOptions: Pick<EnvironmentOptions, "weather">

Options for weather configuration in an Environment.


Audio

Audio(attenuationModel, enabled, looping, maxAttenuationDist, minAttenuationDist, playOnSignal, playSpeed, rollOffFactor, solo, soundType, src, startPlayingDist, volume): HDK React Component

Add an audio source, either an audio preset or an external url. An audio source can be added to any object, or to a point in space.

Parameters

NameTypeDescription
attenuationModelcommon.AudioAttenuationModelThe way sound changes as you move around. NO_ATTENUATION, INVERSE_DISTANCE, EXPONENTIAL_DISTANCE or the default LINEAR_DISTANCE
enabledbooleanfalse means the audio is absent from the scene.
loopingbooleanfalse means the sound will only play once, otherwise it will repeat.
maxAttenuationDistnumberThe maximum distance the sound can be heard, defaults to 20.
minAttenuationDistnumberThe minimum distance the sound can be heard, defaults to 5.
playOnSignalSignalListenerReference & PlayAudioOnSignalSoloPropsIf defined, uses a signal to toggle playing the sound.
playSpeednumber-
rollOffFactornumberHow fast the sound tapers away.
solobooleantrue means all other sounds are paused while playing this one.
soundTypecommon.SoundType-
srcAudioSourceThe source of the sound, either an id or an external url.
startPlayingDistnumberThe distance at which the sound starts playing, defaults to 20.1.
volumenumberThe volume of the sound, defaults to 2.

Returns

HDK React Component

See

Example

<Audio src={{ id: "a_am_city_01" }} volume={3} />

Environment

Environment(assetIDs, bloom, colorGrading, extendEnvironment, fog, id, lightboxBrightness, reflectionboxBrightness, skybox, skyboxBrightness, skyboxSaturation, sun, weather): HDK React Component

Registers an environment for rendering scenes.

Parameters

NameTypeDescription
assetIDsAssetIDOptionsIds for skybox, reflection box, and light box assets.
bloomBloomOptionsOptions for bloom's bright threshold and blend alpha.
colorGradingColorGradingOptionsOptions for color grading's hue, saturation, brightness, contrast, and tint colors.
extendEnvironmentEnvironmentIdid of the environment to extend.
fogFogOptionsOptions for fog's color, density, height, inversion, and skybox effects.
idstringThe id of the environment.
lightboxBrightnessnumber-
reflectionboxBrightnessnumber-
skyboxCubeMapOptionsURLs for each side of the skybox.
skyboxBrightnessnumber-
skyboxSaturationnumber-
sunSunOptionsOptions for sun's position, color, strength, and exposure luminance.
weatherWeatherSettings for the weather, refer to WeatherPresets.

Returns

HDK React Component

See

Fundamentals (opens in a new tab) for basic component placement.

Example

const World = () => (
  <HNode>
    <Prefab id={'sphere_01'} scale={3} scaleY={1.5} y={-3} material={'chrome'} />
    <Environment
      id="my_env"
      sun={{
        position: [-1, 1, 1],
        color: '#63c5ea',
      }}
      fog={{
        color: '#63c5ea',
        density: 0.0000001,
      }}
      weather={WeatherPresets.dandelion}
      skybox={{
        back: { url: 'https://cdn.hibervr.com/skybox_cubemaps/underwater_realm/cube_back.png' },
        bottom: { url: 'https://cdn.hibervr.com/skybox_cubemaps/underwater_realm/cube_down.png' },
        front: { url: 'https://cdn.hibervr.com/skybox_cubemaps/underwater_realm/cube_front.png' },
        left: { url: 'https://cdn.hibervr.com/skybox_cubemaps/underwater_realm/cube_left.png' },
        right: { url: 'https://cdn.hibervr.com/skybox_cubemaps/underwater_realm/cube_right.png' },
        top: { url: 'https://cdn.hibervr.com/skybox_cubemaps/underwater_realm/cube_up.png' },
      }}
    />
  </HNode>
);
render(<World />, { environment: 'my_env' });

Custom environment


Prefab

Prefab(id, material): HDK React Component

Represents a prefabricated object in the scene.

Parameters

NameTypeDescription
idstringThe id of the prefab to add.
materialMaterialIdThe material to apply to the prefab.

Returns

HDK React Component

See

Fundamentals (opens in a new tab) for basic component placement.

Example

<Prefab id="cube_01" />

PrefabSpawner

PrefabSpawner(firstSpawnShouldBeInstant, intervalRule, prefabID, resetOnPlayerIntentChanged, resetOnPlayerRespawn, spawnAmount, spawnAmountMax, spawnAmountMin, spawnAmountRule, spawnInterval, spawnIntervalMax, spawnIntervalMin, spawnRule, spawnedAmountLimit, startIdle): HDK React Component

A component that spawns a prefab.

Parameters

NameTypeDescription
firstSpawnShouldBeInstantbooleanWhether the first spawn should be instant. Defaults to true.
intervalRulecommon.PrefabSpawnerIntervalRuleThe rule that determines how often the spawner should spawn a prefab. Defaults to 'DEFAULT'.
prefabIDPrefabIdThe ID of the prefab to spawn. Optional if using built in prefab id.
resetOnPlayerIntentChangedbooleanWhether the spawner should reset when the player changes intent. Defaults to true.
resetOnPlayerRespawnbooleanWhether the spawner should reset when the player respawns. Defaults to true.
spawnAmountnumberThe amount of prefabs to spawn. Used when spawnAmountRule = DEFAULT. Defaults to 1.
spawnAmountMaxnumberThe maximum amount of prefabs to spawn. Used when spawnAmountRule = RANDOM. Defaults to 0.
spawnAmountMinnumberThe minimum amount of prefabs to spawn. Used when spawnAmountRule = RANDOM. Defaults to 0.
spawnAmountRulecommon.PrefabSpawnAmountRuleThe rule that determines how many prefabs should be spawned. Defaults to 'DEFAULT'.
spawnIntervalnumberThe interval in seconds between each spawn. Defaults to 1.
spawnIntervalMaxnumber-
spawnIntervalMinnumber-
spawnRulecommon.PrefabSpawnerSpawnRuleThe rule that determines when the spawner should spawn a prefab. Defaults to 'START_WHEN_EMPTY'.
spawnedAmountLimitnumberThe maximum amount of spawned prefabs that exist in the world simultaneously. Defaults to 1.
startIdlebooleanWhether the spawner shouldn't spawn a prefab automatically. Defaults to false.

Returns

HDK React Component

See

Fundamentals (opens in a new tab) for basic component placement.

Example

Spawn a built in prefab

<PrefabSpawner prefabID="cube_01" />

Example

Spawn a custom prefab, a spinning hovering cube

<PrefabSpawner y={2} z={2}>
  <Spinning>
    <Hovering>
      <Prefab id="cube_01" />
    </Hovering>
  </Spinning>
</PrefabSpawner>

Temporary

Temporary(lifespan): HDK React Component

A component that provides property context for all children and removes them after a specified lifespan. This component has no placing or rendering capabilities. It is only used to add context to children.

Parameters

NameTypeDescription
lifespannumberThe lifespan in seconds.

Returns

HDK React Component

Example

<Temporary lifespan={5}>
  <HNode z={2}>
    <Prefab id="cube_01" />
    <Prefab id="cube_01" x={5} y={2} />
    <Prefab id="cylinder_01" />
  </HNode>
</Temporary>

Text

Text(billboard, color, shadow, size, transparency): HDK React Component

A component that renders text.

Parameters

NameTypeDescription
billboardbooleanWhether the text should face the user.
colorColorThe color of the text.
shadowbooleanWhether the text should have a shadow.
sizenumberThe size of the text.
transparencynumberThe transparency of the text color. A value between 0 and 1.

Returns

HDK React Component

Example

<Text billboard size={2} shadow>Hello, world!</Text>

Context

Apply

Apply(props): HDK React Component

Provides property context for all children. This is used to provide a default set of props that will be applied to all children. This component has no placing or rendering capabilities. It is only used to add context to children.

Parameters

NameTypeDescription
propsOmit<MetadataProps & { children?: ReactNode ; key?: null | string | number ; name?: string } & { apply?: (props: MetadataProps & { name?: string | undefined; key?: string | number | null | undefined; children?: ReactNode; } & { engineId?: number | undefined; showAxisMarker?: boolean | undefined; engineProps?: PropertyAsProperties | undefined; apply?: ((props: MetadataProps & ... 2 more ... & DeepPartial<...>) => MetadataProps ...) => MetadataProps & { name?: string | undefined; key?: string | number | null | undefined; children?: ReactNode; } & { engineId?: number | undefined; showAxisMarker?: boolean | undefined; engineProps?: PropertyAsProperties | undefined; apply?: ((props: MetadataProps & ... 2 more ... & DeepPartial<...>) => MetadataProps ... ; engineId?: number ; engineProps?: PropertyAsProperties ; showAxisMarker?: boolean } & DeepPartial<VectorProperties & RotationProperties & ScaleProperties>, "animation"> & AnimationPropsContext to apply.

Returns

HDK React Component

Example

// Apply x:2 on all nodes named 'arm', even if 'x' is explicitly set.
<Apply props={{ x: 2 }} when={node => node.name === 'arm'}>
  <HNode z={2}>
    <Prefab id="cube_01" name="arm" />
    <Prefab id="cube_01" name="arm" x={5} y={2} />
    <Prefab id="cylinder_01" name="body" />
  </HNode>
</Apply>

Random

Random(seed): HDK React Component

Set a new random seed context for its children.

Since we want to have the same random values every time we render the scene, we need to use a random seed algorithm. This algorithm is based on the seed value that is passed to the Random component and will generate the same random values every time the seed is the same. If you want another set of random values, you can pass another seed value.

To wrap your component in a random seed context is only needed if you want to use another seed context that the default one. In most cases you don't have to use this component.

This component has no placing or rendering capabilities. It is only used to add context to children.

Parameters

NameTypeDescription
seednumberThe seed value to use for the random seed algorithm.

Returns

HDK React Component

Example

// Lets create a component that returns a set number of items with random values.
type MyRandomThingProps = {
  numberOfThings?: number;
};
 
const MyRandomThing: HDKComponent<MyRandomThingProps> = ({ numberOfThings = 10, ...props }) => {
 const things = [];
 const random = useRandom();
 for (let index = 0; index < numberOfThings; index++) {
   things.push(
     <Prefab
       id="rounded_cube_01"
       scaleX={random.range(1, 3)}
       scaleY={random.range(1, 3)}
       scaleZ={random.range(1, 3)}
       x={random.range(-4, 4)}
       y={random.range(0, 8)}
       z={random.range(-4, 4)}
       rotX={random.range(0, 360)}
       rotY={random.range(0, 360)}
       rotZ={random.range(0, 360)}
       material={random.fromArray(['palette_01_green', 'palette_01_red', 'palette_01_blue', 'palette_01_yellow'])}
     />
   );
 }
 return <HNode {...props}>{things}</HNode>;
}
 
// Now we can use this component in our scene.
// We wrap the component in a <Random> component to set the seed.
<Random seed={42}>
  <MyRandomThing z={10} />
</Random>
};

Gameplay

PowerUp

PowerUp(abilities, spawnerProps): HDK React Component

Add a power up pick up that spawns on an interval. Its children will be the pick up.

Parameters

NameTypeDescription
abilities(AbilityId | Omit<AbilityProps, 'id'>)[]The abilities that will be activated when you pick up the power up.
spawnerPropsOmit<PrefabSpawner, "prefabID">Config for the spawner.

Returns

HDK React Component

See

Fundamentals (opens in a new tab) for basic component placement.

Example

<PowerUp abilities={["a_consume_increase_speed"]} spawnerProps={{ spawnInterval: 5 }}>
  <Prefab id="gpl_dynamite_01" />
</PowerUp>

Light

PointLight

PointLight(color, lightOnSignal, offset, radius, strength): HDK React Component

Add a point light to the scene.

Parameters

NameTypeDescription
colorColorThe color of the light, defaults to white.
lightOnSignalSignalListenerReferenceIf specified, use a signal to turn the light on and off.
offsettypes.float3-
radiusnumberThe radius of the light, defaults to 10.
strengthnumberThe strength of the light, defaults to 50.

Returns

HDK React Component

Warning

Don't place too many lights close to each other, this will cause artifacts.

See

Fundamentals (opens in a new tab) for basic component placement.

Example

<PointLight strength={50} color="#ffff00" radius={10} />

PointLight


SpotLight

SpotLight(color, dir, lightOnSignal, offset, openingAngleDegs, radius, strength): HDK React Component

Add a spotlight to the scene.

Parameters

NameTypeDescription
colorColorThe color of the spotlight, defaults to yellow [255, 213, 97]. Warm white
dirtypes.float3The direction of the spotlight, defaults is down [0, -1.0, 0].
lightOnSignalSignalListenerReferenceUse a signal to turn the light on and off, defaults to undefined.
offsettypes.float3The offset of the spotlight, defaults to [0, 0, 0].
openingAngleDegsnumberThe opening angle of the spotlight, defaults to 130.
radiusnumberThe radius of the spotlight, defaults to 10.
strengthnumberThe strength of the spotlight, defaults to 25.

Returns

HDK React Component

Warning

Don't place too many lights close to each other, this will cause artifacts.

See

Fundamentals (opens in a new tab) for basic component placement.

Example

<SpotLight openingAngleDegs={30} radius={200} strength={50} color="#00aeff">
 <Mesh id="en_p_light_cone_02" material={'t_light_cone_01' as Material} y={2.2} rotX={180} physical={false} />
</SpotLight>

SpotLight

Media

GLB

GLB(collider, material, render, src): HDK React Component

Adds an external GLB Mesh to the scene. Supports GLB format.

Parameters

NameTypeDescription
colliderbooleanfalse means the object will be non-physical.
materialMaterialIdOverride the built in material to use for the mesh.
renderboolean-
srcAudioSourceUrl of the glb file

Returns

HDK React Component

See

Fundamentals (opens in a new tab) for basic component placement.

Example

<GLB src="https://cdn.hibervr.com/test/Spheres.glb" y={2} z={3}></GLB>

GFL


InfoPanel

InfoPanel(autoOpenOverlay, body, header, imageID, isOpenInNewTabEnabled, isOpenInOverlayEnabled, isOpenInOverlayOnTouch, isSidebarOverlay, maxShowDistance, minShowDistance, openUrlInNewTab, preBody, showOpenBinding, url): HDK React Component

Makes all children show an info panel when looking at them. The info panel can be used to open up a web page for further interaction.

Parameters

NameTypeDescription
autoOpenOverlayboolean-
bodytypes.str80The body of the info panel, max 80 characters.
headerstringThe header of the info panel.
imageIDtypes.TextureIDThe icon that should be shown the info panel.
isOpenInNewTabEnabledbooleantrue if interacting withthe info panel should open the url in a new tab.
isOpenInOverlayEnabledbooleantrue if opening the url should be in an overlay, if applicable.
isOpenInOverlayOnTouchbooleantrue if the overlay should be available on touch.
isSidebarOverlaybooleanfalse if the overlay should be shown as a sidebar.
maxShowDistancenumberThe max distance at which the info panel should be shown.
minShowDistancenumberThe min distance at which the info panel should be shown.
openUrlInNewTabbooleantrue if the url should be opened in a new tab rather than the current.
preBodytypes.str80The ingress of the info panel, max 80 characters.
showOpenBindingbooleantrue if the 'open' binding key should be shown in the panel.
urlstringThe target url for interacting with the panel.

Returns

HDK React Component

Example

<InfoPanel
     header="Hiber3D Development Kit"
     body="Check out our documentation!"
     url="https://developer.hiber3d.com/docs"
     openUrlInNewTab={true}>
     <Prefab id="hologram_01_hibert" />
   </InfoPanel>

Other

HDKComponentArgs

HDKComponentArgs: HDKElementArgs & { apply?: (props: HDKComponentArgs) => HDKComponentArgs ; engineId?: number ; engineProps?: properties.PropertyAsProperties ; showAxisMarker?: boolean } & TransformProperties

Base props for all placeable HDK React components


HDKElementArgs

HDKElementArgs: MetadataProps & { children?: React.ReactNode ; key?: string | number | null ; name?: string }

Base props for nodes in a HDK React component tree


MetadataProps

MetadataProps: Object

Base metadata props for all HDK React components

Type declaration

NameType
metadata?DeepPartial<Metadata>

GameplaySettings

GameplaySettings(gameplayMatchSettings, gameplayRules, id): HDK React Component

Registers gameplay settings for the world

Parameters

NameTypeDescription
gameplayMatchSettingsGameplayMatchSettings-
gameplayRulesGameplayRule[]-
idstringThe id of the gameplay settings, to be referenced as "gameplaySettings" in the render function

Returns

HDK React Component


HttpOnSignal

HttpOnSignal(input, url): HDK React Component

Component that triggers a HTTP request to a specified url when a signal is activated This component has no placing or rendering capabilities. It is only used to emit signals.

Parameters

NameTypeDescription
inputSignalIdThe signal to listen to
urlstringThe url to request when the signal is activated

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.


HttpSensor

HttpSensor(output, pollEnabled, pollInterval, url): HDK React Component

Sensor component that activates its signal when it gets a 200 statusCode back from an external url This component has no placing or rendering capabilities. It is only used to emit signals.

Parameters

NameTypeDescription
outputSignalIdThe output signal
pollEnabledbooleanEnable polling for an updated status code. Defaults to true
pollIntervalnumberThe interval to poll in seconds. Defaults to 10.
urlstringThe url to poll for a status code

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.


LatchGate

LatchGate(input, output, resetInput): HDK React Component

A Gate that will toggle its output each time the input signal switches from OFF to ON.

Parameters

NameTypeDescription
inputSignalIdThe input signal
outputSignalIdThe output signal that will be toggled
resetInputSignalIdAn optional signal that will reset the output to OFF

Returns

HDK React Component


MatchStateSensor

MatchStateSensor(output, state, turnSignalOffNextTick): HDK React Component

Sensor component that activates its signal when the match state enters the given state

Parameters

NameTypeDescription
outputSignalIdThe output signal
stateSignalMatchStateThe state to listen for
turnSignalOffNextTickbooleanIf true, the signal will be turned off the next tick after it has been turned on

Returns

HDK React Component


ResetOnSignal

ResetOnSignal(input, resetPlayers, restartLevel): HDK React Component

Component that resets the level and/or players when a signal is activated

Parameters

NameTypeDescription
inputSignalIdThe signal to listen to
resetPlayersfalse | "RESTART" | "RESPAWN"Whether to reset or respawn the players. Defaults to 'RESTART'
restartLevelbooleanWhether to restart the level state. This will reset all animations / signals etc. Defaults to true

Returns

HDK React Component


SetMatchStateOnSignal

SetMatchStateOnSignal(input, state): HDK React Component

Set the match state when a signal is activated

Parameters

NameTypeDescription
inputSignalIdThe signal to listen to
stateSignalMatchStateThe state to set the match to

Returns

HDK React Component

Signals

AndGate

AndGate(inputs, output): HDK React Component

Logical AND gate component. The output signal is true if all input signals are true. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
inputsSignalId[]A list of input signals. At least 2
outputSignalIdThe output signal. Must be unique

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<ButtonSensor output="myButton2" x={2} />
<AndGate output="myOutput" inputs={["myButton1", "myButton2"]} />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>

ButtonSensor

ButtonSensor(cooldownInSeconds, durationInSeconds, materialOff, materialOn, maxDistance, meshId, onPress, output, resetInput): HDK React Component

Sensor Component that toggles its output signal ON and OFF when the button is pressed.

Parameters

NameTypeDescription
cooldownInSecondsnumberThe cooldown in seconds after which the button can be pressed again. Defaults to undefined, which means the button can be pressed again immediately.
durationInSecondsnumberThe duration in seconds after which the button will turn off again. Defaults to undefined, which means the button will stay on forever.
materialOffMaterialIdThe material to use when the output signal is OFF. Defaults to a red material
materialOnMaterialIdThe material to use when the output signal is ON. Defaults to a green material
maxDistancenumberThe maximum distance at which the button can be pressed. Defaults to 10.
meshIdMeshIdThe mesh to use for the button. Defaults to a button mesh
onPressSignalIdA pulse signal output that will be sent when the button is pressed. Useful for resetting other ButtonSensors by setting this output as resetInput prop on them. Optional.
outputSignalIdThe output signal that will be toggled by pressing the button
resetInputSignalIdA signal that will reset the button to OFF. Prefarably a pulse since the ButtonSensor will forced to off as long as this signal is on. Defaults to no signal which means it will not be used.

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<Button output="myButton1" />
<VisibleOnSignal input="myButton1">
  <Prefab id="ancient_urn_01" x={2} />
</VisibleOnSignal>

CapacitorSensor

CapacitorSensor(delayInSeconds, input, output): HDK React Component

Sensor Component that delays inactivation of the output signal by a given amount of time. This component has no placing or rendering capabilities. It is only used to emit signals.

Parameters

NameTypeDescription
delayInSecondsnumberThe delay in seconds. Defaults to 1 second.
inputSignalIdThe input signal to listen to
outputSignalIdThe output signal that will have the inactivation delay

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<Button output="myButton1" />
<CapacitorSensor input="myButton1" output="myButton1Delayed" delayInSeconds={2} />
<VisibleOnSignal input="myButton1Delayed">
  <Prefab id="ancient_urn_01" x={2} />
</VisibleOnSignal>

InvisibleOnSignal

InvisibleOnSignal(input): HDK React Component

Component that makes its children invisible when the input signal is true.

Parameters

NameTypeDescription
inputSignalIdThe input signal to listen to

Returns

HDK React Component

Example

<Button output="myButton1" />
<InvisibleOnSignal input="myButton1">
  <Prefab id="ancient_urn_01" x={2} />
</InvisibleOnSignal>

LogicGate

LogicGate(input1, input2, output, type): HDK React Component

Base logic gate component. The output signal value is determined by the type of gate and the input signals. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
input1SignalIdAn input signal
input2SignalIdAnother input signal
outputSignalIdThe output signal. Must be unique
typeLogicGateType-

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<ButtonSensor output="myButton2" x={2} />
<LogicGate type="AND" output="myOutput" inputs={["myButton1", "myButton2"]} />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>

LookAtSensor

LookAtSensor(maxDistance, mesh, minDistance, output, showMesh): HDK React Component

Sensor Component that activates its output signal when looked at by the player. This component has no placing or rendering capabilities. It is only used to emit signals.

Parameters

NameTypeDescription
maxDistancenumberThe maximum distance at which the sensor will activate its output signal. Defaults to 1000
meshMeshIdThe mesh to use for the sensor. Defaults to sphere
minDistancenumberThe minimum distance at which the sensor will activate its output signal. Defaults to 0
outputSignalIdThe output signal that will be activated when looked at
showMeshbooleantrue will show the sensor's mesh for debugging purposes.

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<LookAtSensor output="mySignal" mesh="box" />
<VisibleOnSignal input="mySignal">
  <Prefab id="ancient_urn_01" x={2} />
</VisibleOnSignal>

LookAtSphereSensor

LookAtSphereSensor(maxDistance, minDistance, output, showSphere): HDK React Component

Sensor Component that activates its output signal when looked at by the player. This component has no placing or rendering capabilities. It is only used to emit signals.

Parameters

NameTypeDescription
maxDistancenumberThe maximum distance at which the sensor will activate its output signal. Defaults to 1000
minDistancenumberThe minimum distance at which the sensor will activate its output signal. Defaults to 0
outputSignalIdThe output signal that will be activated when looked at
showSphereboolean-

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<LookAtSphereSensor output="mySignal" />
<VisibleOnSignal input="mySignal">
  <Prefab id="ancient_urn_01" x={2} />
</VisibleOnSignal>

MaterialOnSignal

MaterialOnSignal(input, materialOff, materialOn): HDK React Component

Component that makes its children change material when the input signal is true.

Parameters

NameTypeDescription
inputSignalIdThe input signal to listen to
materialOffMaterialIdThe material to apply when the signal is false
materialOnMaterialIdThe material to apply when the signal is true

Returns

HDK React Component

Example

<Button output="myButton1" />
<MaterialOnSignal input="myButton1" materialOn="palette_01_black" materialOff="palette_01_white">
  <Prefab id="ancient_urn_01" x={2} />
</MaterialOnSignal>

MultiInputGate

MultiInputGate(inputs, output, renderGate): HDK React Component

Multi-input gate component. The output signal value is determined by the type of gate and the input signals. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
inputsSignalId[]A list of input signals. At least 2
outputSignalIdThe output signal. Must be unique
renderGateLogic gate factory functionfunction to use when rendering a gate.

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<ButtonSensor output="myButton2" x={2} />
<MultiInputGate type="AND" output="myOutput" inputs={["myButton1", "myButton2"]} />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>

NandGate

NandGate(inputs, output): HDK React Component

Logical NAND gate component. The output signal is true as if NOT all input signals are true. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
inputsSignalId[]A list of input signals. At least 2
outputSignalIdThe output signal. Must be unique

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<ButtonSensor output="myButton2" x={2} />
<NandGate output="myOutput" inputs={["myButton1", "myButton2"]} />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>

NorGate

NorGate(inputs, output): HDK React Component

Logical NOR gate component. The output signal is true if all input signals are false. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
inputsSignalId[]A list of input signals. At least 2
outputSignalIdThe output signal. Must be unique

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<ButtonSensor output="myButton2" x={2} />
<NorGate output="myOutput" inputs={["myButton1", "myButton2"]} />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>

NotGate

NotGate(input, output): HDK React Component

Logical NOT gate component. The output signal is true if the input signal is false. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
inputSignalIdAn input signal to invert
outputSignalIdThe output signal. Must be unique

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<NotGate output="myOutput" input="myButton1" />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>

OrGate

OrGate(inputs, output): HDK React Component

Logical OR gate component. The output signal is true if any of the input signals are true. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
inputsSignalId[]A list of input signals. At least 2
outputSignalIdThe output signal. Must be unique

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<ButtonSensor output="myButton2" x={2} />
<OrGate output="myOutput" inputs={["myButton1", "myButton2"]} />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>

ProximitySensor

ProximitySensor(maxDistance, minDistance, output, showMaxDistance): HDK React Component

Sensor Component that activates its output signal when the player gets close enough. This component has no placing or rendering capabilities. It is only used to emit signals.

Parameters

NameTypeDescription
maxDistancenumberThe maximum distance at which the sensor will activate its output signal. Defaults to 1000
minDistancenumberThe minimum distance at which the sensor will activate its output signal. Defaults to 0
outputSignalIdThe output signal that will be activated when looked at
showMaxDistancebooleantrue will show the sensor's distance trigger for debugging purposes.

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<HNode x={10}>
  <ProximitySensor output="mySignal" />
  <Prefab id="cube_01" />
</HNode>
<VisibleOnSignal input="mySignal">
  <Prefab id="ancient_urn_01" x={2} />
</VisibleOnSignal>

ResistorSensor

ResistorSensor(delayInSeconds, input, output): HDK React Component

Sensor Component that delays activation of the output signal by a given amount of time. This component has no placing or rendering capabilities. It is only used to emit signals.

Parameters

NameTypeDescription
delayInSecondsnumberThe delay in seconds. Defaults to 1 second.
inputSignalIdThe input signal to listen to
outputSignalIdThe output signal that will have the activation delay

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<Button output="myButton1" />
<ResistorSensor input="myButton1" output="myButton1Delayed" delayInSeconds={2} />
<VisibleOnSignal input="myButton1Delayed">
  <Prefab id="ancient_urn_01" x={2} />
</VisibleOnSignal>

SignalListener

SignalListener(input): HDK React Component

Represents a component signal input source, as a composite part of a listener.

Parameters

NameTypeDescription
inputSignalIdThe input signal

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.


SpawnPrefabOnSignal

SpawnPrefabOnSignal(id, input): HDK React Component

Component that spawns a prefab at this objects position when the input signal is true.

Parameters

NameTypeDescription
idstringThe prefab ID to spawn
inputSignalIdThe input signal to listen to

Returns

HDK React Component

Example

<Button output="myButton1" />
<SpawnPrefabOnSignal input="myButton1" id="balloons_01" />

VisibleOnSignal

VisibleOnSignal(input): HDK React Component

Component that makes its children visible when the input signal is true.

Parameters

NameTypeDescription
inputSignalIdThe input signal to listen to

Returns

HDK React Component

Example

<Button output="myButton1" />
<VisibleOnSignal input="myButton1">
  <Prefab id="ancient_urn_01" x={2} />
</VisibleOnSignal>

XnorGate

XnorGate(inputs, output): HDK React Component

Logical XNOR gate component. The output signal is true if all input signals match each other. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
inputsSignalId[]A list of input signals. At least 2
outputSignalIdThe output signal. Must be unique

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<ButtonSensor output="myButton2" x={2} />
<XnorGate output="myOutput" inputs={["myButton1", "myButton2"]} />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>

XorGate

XorGate(inputs, output): HDK React Component

Logical XOR gate component. The output signal is true if any of the input signals doesn't match the others. This component has no placing or rendering capabilities. It is only used to process signals.

Parameters

NameTypeDescription
inputsSignalId[]A list of input signals. At least 2
outputSignalIdThe output signal. Must be unique

Returns

HDK React Component

See

Signals (opens in a new tab) for more info about signals.

Example

<ButtonSensor output="myButton1" />
<ButtonSensor output="myButton2" x={2} />
<XorGate output="myOutput" inputs={["myButton1", "myButton2"]} />
<VisibleOnSignal input="myOutput">
  <Prefab id="ancient_urn_01" />
</VisibleOnSignal>