Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

intermediate

Antoine Charton edited this page Apr 23, 2018 · 61 revisions

What will I learn?

  • Basic operations and patterns (condition, make a counter...).
  • A character reacting to an user input

Setup

  • Create a new scene, and add a cube gameobject (/Gameobject/3D/Cube).
  • Add a ConstellationBehaviour component to the cube.
  • Create a new Constellation. Give it a cool name.
  • Add your script to the ConstellationBehaviour component.
  • You are setted!

Basic patterns

Add pattern

alt text

What's happening?

  1. Store the value to add and push it on Update.
  2. Store the current count.
  3. Add the current count to the incremental value.

When could I use it?

  1. To store a character life. In this example the S key simulate an event that make the character loose some life. alt text
  2. Moving a character. alt text

Condition

alt text

  • Condition node works like a if in programming.

attributes

  • The first attribute is the condition. There are 6 of them: ==, <=, >=, !=, <, >
  • The $ sign followed by a number represent the input that is checked. For example $1 refers to the first input. $3 refers to the last one.
  • The then field can output a constant number or word. For example if you enter 1 in this field the node will output one when the condition is met. If you put $1 on this field it will output the first input of the if node.
  • The else field work the same as the then field but output a value if the condition aren't met.

inputs

  1. $1.
  2. $2.
  3. $3.

outputs.

  1. Output a variable when condition is met.
  2. Output variable when condition is not met.
  3. Always output a variable.

Character movement.

Move your character with W,A,S,D

alt text

  1. Character controller node will add the Unity CharacterController component on the gameobject on which the constellation is attached to.
  2. You need to use Delta times if your framerate is not constant. Keep in mind there is a lot of different ways to achieve this. You could also use a transform or rigid body node depending on what kind of movement you need.

Make it look at your mouse position

alt text

  1. The camera ray node needs a 2d position relative to your screen. It outputs an an array of 3 floats (x,y,z).
  2. The LookAtPosition node needs the position of the GameObject and the position of where it should look at. When the warm input is triggered it outputs a target rotation.
  3. At the end you split the target rotation to get only the Y axis of the target rotation. An extra step could be to smooth over time this value so your character does not rotate in one frame.

Practice

  • Make a script so the camera look at your moving character.

Hint you will need an object attribute node to track your character.

Tutorials

Beginner

intermediate

advanced

OSC

Contribute

Create a node

Documentation

[Error codes] link

Clone this wiki locally