Scripting Guide

  • Install

    The python module can be downloaded on Github →
    To install, simply run sudo pip install Asteroid-Module/ --upgrade

  • Module overview

    Asteroid objects are an interface between Swift objects and Python scripting. Given a raw Swift object as input, Asteroid objects can be created.

    asteroid.ar → AR-specific objects and functions.
    asteroid.core → Core classes defining the most basic Asteroid objects and variables.
    asteroid.ml → Machine learning-specific objects and functions.
    asteroid.objects → Definition of an Asteroid game object.
    asteroid.render → Graphics-specific objects and functions.
    asteroid.variables → Definition of an Asteroid variable.

  • Game Objects

    The building block of the Asteroid API is the GameObject wrapper. Every game object has a number of SettingsBlocks attached to it, and every SettingsBlock has several variables.

    There are different types of GameObject for different components of the Asteroid scene. Each has a number of unique methods that can be used to manipulate the objects and models in the scene. For example, if you wanted to change the color of a LightingObject you could use the setColor method found in the reference →

  • Game Variables

    Once you have a wrapper for a AsteroidGameObject, you can get accessors to it's variables. For each SettingsBlock attached to the object, you can use that index to retrieve it's named variables.

    To get a variable object, you might do something like obj_transform = obj.variable("transform", block_index=0)

    The AsteroidVariable class allows you to get and set new values for the gameobjects variables. Most of these (strings, etc) are regular Python objects.

    In the case of the Transform type object, the variable can be updated by using a setter function you can look up in the reference →

    So you might do something like obj_transform.update("pos", 1, 0.5)

  • In-built shell

    Asteroid comes with a built in scripting shell, as well as capabilities for Python scripting. The in-built Asteroid shell comes with the asteroid module loaded. There is a value called scene representing the scene graph of the simulation. All of the module functions can be accessed via the repl.

© 2018 by Asteroid. All rights reserved.