Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.
Antoine Charton edited this page Feb 7, 2018 · 68 revisions

Quick start

If you are not familiar at all with unity I suggest you start with the interface tutorials first. This tutorial assumes that you are at least some basic knowledge of it.

What will I learn?

  • How to setup constellations.
  • The basic of the interface.
  • The basic principles of Constellation scripting.
  • Controlling a gameobject.

What do I need?

  • You need the latest version of unity
  • When your unity is installed, you can Download or clone the repo.
  • Open the project with unity 2017.3.

The interface

Open the editor

  • Open the constellation Window. Can be found in Unity menus in Window/Constellation Editor.
  • Once it's done, click Load Constellation button and open bird.asset.

Editor anatomy

alt text

  • Constellation tab: Currently open constellation.
  • Node selection panel: The node list. Click one in the list to add it.
  • Node editor: Where you edit your scripts.

Live profiling

alt text

  • Open the FlappyBird scene.
  • Hit play.
  • Click on gameobject that has a constellation script attached. In this example, it's pref_bird
  • You should see the live values.

Assigning your script to a GameObject

  • Create a new scene.
  • Create a new GameObject.
  • Add a Constellation behaviour component to your GameObject alt text
  • Add your Constellation script the script field.

Integrated documentation

alt text

  • Click on the question mark on a node to get more information about it and examples

Scripting principles

For this section it's advised to have a unity and constellation window opened. It's will help you understand how it works

Setup

  • Create a new Scene.
  • Create a new Constellation. From Constellation editor, click file/new. The shortcut is ctrl+alt+n. Give your script a cool name!
  • Create a new Gameobject and add a constellationBehaviour component. Add your script with a cool name to the constellation behaviour.

Anatomy of a node

alt text

  • Inputs set variables in the node.
  • Outputs are the result.
  • A Variable is either a number, a string, an array, an object, or a list of variable (Very similar to the war in javascript).
  • A Unity variable is an object which inherits from unity object (Example transform, GameObject, Component).
  • Links allow you to connect a node output to a node input.

Understanding warm and cold

Quick example

  • For this one I suggest you try to reproduce the examples and experiment with them. It will be easier for you to understand how it works.
  • Add a word node (Is inside Basics nodes namespace) and 2 var nodes.
  • Connect them to reproduce what's on the image below.
  • Select the Gameobject on which you assigned your cool script and hit play. alt text
  • You can see that the first var is set, but the second one is not. It's because a cold input is used to set a variable. It does not trigger an output.​
  • To fix that you need to tell the var node push its value. To do so, we will add an Update node and connect it to the warm input of the var. alt text

What should I remember

  • A cold input sets a value but do not push it
  • A warm input will trigger an output.
  • A warm output is triggered without warm input. For example keyDown node will trigger an output because a key is pressed.
  • A cold output is triggered only when a warm input receives a message.

Understand node Execution order.

  • In constellation nodes are executed from top to bottom.
  • To test that just add a word node and a print node. Enter in the attribute field "Word 1" and connect it to the print.
  • Add another word node, place it bellows the previous word, set the field to "Word 2" and connect it to the print node.
  • Select your cube make sure your constellation editor is opened and hit play!
  • You should see in the console

Word 1

Word 2

alt text

  • Stop playing.
  • Now try to put the word 2 node on top of the word 1.
  • You will see now that word 2 is printing before word 1.

Word 2

Word 1

alt text

Move a gameobject

Transform

  • Create a new Constellation.
  • Add it to a cube.
  • Add a transform node.

see that A transform node has 5 inputs

  1. The transform (default is the gameobject to which it's attached)
  2. Position (Vec3).
  3. Rotation (Vec3).
  4. Scale (Vec3).
  5. Push values (Trigger the outputs).

It has 4 outputs

  1. The position.
  2. The rotation.
  3. The scale.
  4. The transform.
  • If you want to see more details on the inputs or outputs you can right click over one. It will show you basics informations.
  • To set the position you will need a Vec3 node. Add one and connect it to the second intput of the node (see image). alt text
  • You can try messing around with the values to understand a bit how it works.

Little exercise.

Interface

  • Reproduce the script on the image below and understand what it does using internal documentation.
  • Assign it to a Gameobject.

Scripting

  • Move the Y position instead of the Z position.

alt text

Bonus: Warm and cold

  • Try to print in the console the rotation on the X axis of the transform (hint: you will require a split Vec3 node).