Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Tutorial:Vectors

From Resonite Wiki
This page is mostly a page of notes and 'cookbook' of flux examples. This is not (yet) a tutorial. Input and content is welcome.

Vectors encode both direction and magnitude, they are used throughout physics to represent velocity. This is the primary context that they will be used here.

One of the most common version a user of Resonite is likely to encounter is the 3D instantaneous(?) vector and is represented as a float3. Direction is encoded by the ratio between X,Y,Z. Magnitude('speed') is encoded by the combined values. They can be negative as well as positive.

While entangled as a single set of values,the two pieces of information are each being able to be manipulated independently of the other through a number of operators.

One important concept that will come up in this cookbook is of a 'normalized' vector. This effectively removes the magnitude (Or removes the 'difference in magnitude' between vectors) and allows direction only to be compared or to give a known starting point if you wish to then set a known magnitude.

Cookbook

Finding a direction from one slot to another

Use ProtoFlux:GlobalTransform to get the position of each slot.

Subtract one from the other. This will give you the raw vector, including the distance between the two.

ProtoFlux:Normalized will then give you a direction disregarding magnitude.

Making a vector 'faster/stronger'

Multiply the Float3 floats by the same number. (Float3 x Float3 or Float3 x Float) This will not change its direction.

Changing a vector's direction

An example of how to multiply a vector by a Quaternion to rotate it.

Multiply the vector(Float3) by a Quaternion(FloatQ). (Note: FloatQ must be on top for the node to overload/change correctly)

You can use ProtoFlux:FromEuler to start with a Euler Angle as used in the Inspectors combined with ProtoFlux:Pack3 it will allow changing directions based on other inputs.

One example is to use ProtoFlux:GetUp on a slot to get it's world up, then multiplying it either X(?) sets -45 to 45 will.. stuff. (will update)

Comparing two vectors

ProtoFlux:Dot can be used to compare two ProtoFlux:Normalized vectors to see how close they are to each other.

The result is a float, with 1 being exactly the same and -1 being exactly the opposite.

In Game Tutorials

Interactive Vectors by AxiomWolf is an MMC 2026 world that teaches the fundamentals of vectors and has a great series of interactive tutorials that helps develop your understanding.

See Also

General nodes

In game uses for vectors

External resources