API

Asteroid JS scripts are custom classes, where the "update" function is called once per frame. You can see a sample script here .


The inputs to the update function are set via the "inputs" variable at the top of the script. The inputs can be game objects, or any other kind of variable.


To load a script into Asteroid, create a Javascript Object, and select the JS file from the script dropdown.


    ar
    core objects
    ml
    objects
    render
    variables

class asteroid.objects.AsteroidGameObject(raw_object, factory=None)

Wrapper for the game object

copy(object_factory=None)

“Make a duplicate of an object

createVariable(name, value, var_type, block_index=0)

Add a new variable to a settings block

destroy()

Destroy a gameobject

variable(variable_name, object_factory=0, block_index=0)

“Create the wrapper for an object variable

class asteroid.render.AsteroidRenderObject(raw_object, factory=None)

Wrapper for the render object

ani_keys()

Get animation keys

bounding_box()

Return the bounds of the rendered object

play(string)

Play animation

toggle_visibility()

Make the mesh visible or invisible

updateTransform(vector, index, new_value, template_index=0)

Update the values in the object’s position/ transform

class asteroid.render.AsteroidCameraObject(raw_object, factory=None)

Wrapper for the camera object

disable()

End view from this camera’s perspective

enable()

View from this camera’s perspective

updateTransform(vector, index, new_value, template_index=0)

Update the values in the camera’s position/ transform

class asteroid.render.AsteroidLightingObject(raw_object, factory=None)

Wrapper for the lighting object

disable()

Set a lighting object to off

enable()

Set a lighting object to on

setColor(int)

Change the light color to a hex value

setIntensity(float)

Change the light intensity

setTemperature(float)

Change the light temperature

class asteroid.ml.AsteroidMachineLearningObject(raw_object, factory=None)

Wrapper for a machine learning object

predict(inputs)

Uses the ML model to make a prediction

run_model()

Runs the ML model based on current inputs

set_input(name, value)

Set an value for an input to the ML model

class asteroid.ar.AsteroidCameraInputObject(raw_object, factory=None)

Wrapper for the camera input object

disable()

Disable camera

enable()

Enable camera

getImage(width, height)

Get a frame from the camera object as a PNG representation

class asteroid.ar.AsteroidTrackerObject(raw_object, factory=None)

Wrapper for the tracker object

getDetectedFaces()

Get array of detected faces

getDetectedRectangles()

Get array of detected rectanges

getNumberOfFaces()

Return the number of detected faces

getNumberOfRectangles()

Return the number of detected rectanges

startTrackingFaces()

Track faces from a video feed

startTrackingRectangles()

Track rectangles from a video feed

stopTrackingFaces()

Stop tracking faces from a video feed

stopTrackingRectangles()

Stop tracking rectangles from a video feed

class asteroid.ar.AsteroidMicrophoneInputObject(raw_object, factory=None)

Wrapper for the microphone input object

createInputSession()

Start audio input session

doesDetectedNotesMatchNotesToDetect()

Checks “detectedNotes” match the actual notes detected by the tracker

getAudioAmplitude()

Returns the amplitude of the audio signal

getAudioBufferData()

Returns raw audio buffer data

getAudioFrequency()

Returns the frequency of the audio signal

getFFTData()

Returns FFT data data

getNotes()

Sets the array of notes you want to detect

setNotesToDetect(array)

Sets the array of notes you want to detect

stopInputSession()

Stop audio input session



© 2018 by Asteroid. All rights reserved.

Terms of Service Privacy Policy