This technique was

*sort of*possible before, but it would break if the player looked straight up or down, since it's not possible in that case to find the player's yaw based only on Alidade's Purification. However, the introduction of Theodolite Purification in Hexical 1.3.0 makes this fully possible, as that pattern gives the up vector of the player's head; with that, we have enough information to construct a coordinate space that rotates with the player's head. (This would also be useful for creating HUDs that stay at a constant position in the player's view.)

One interesting use case could be to use this macro along with Mediaworks' Macula and Hexical's Telepathy to implement a working GUI in Hex Casting.

The code for these macros/hexes (and many others) are available on GitHub.

Required mods: MoreIotas, Hexical 1.3.0 (currently unreleased)

Mouse Input

**reference look, reference up, current look, current up → (x, y) | (null, null)**

Given reference and current look/up directions, returns an x/y mouse position relative to the reference position.

The position (0, 0) is at the reference, x increases when yawing right, and y increases when pitching up. The coordinates range from -1 to 1, at -90 and 90 degrees from the reference respectively. If the mouse goes out of bounds in either axis, null is returned for both values.

Required macros: Get Relative Angles

## Patterns

Code: Select all

```
#define Mouse Input (NORTH_WEST awddeeeeeqaqqwq) = vec, vec, vec, vec -> (num, num) | (null, null)
// reference look, reference up, current look, current up -> x, y
// Given reference and current look/up directions, returns an x/y mouse position relative to the reference position.
// The position (0, 0) is at the reference, x increases when yawing right, and y increases when pitching up.
// The coordinates range from -1 to 1, at -90 and 90 degrees from the reference respectively.
// If the mouse goes out of bounds in either axis, null is returned for both values.
{
// duplicate look vectors to use for bounds check later
Numerical Reflection: 4
Dioscuri Gambit II
Bookkeeper's Gambit: v-v----
// get scaled coordinates
Get Relative Angles
Numerical Reflection: -1 // invert pitch
Multiplicative Distillation
Circle's Reflection // tau / 4 = 90 degrees
Numerical Reflection: 4
Division Distillation
Undertaker's Gambit
Division Distillation
Rotation Gambit II
Division Distillation
// bounds check
// since we're restricting each axis to +/- 90 degrees, we can just do a dot product test
Numerical Reflection: 22 // dcba -> abdc
Swindler's Gambit
Multiplicative Distillation
Numerical Reflection: 0
Minimus Distillation
// return null if out of bounds
Nullary Reflection
Nullary Reflection
Rotation Gambit
{
Bookkeeper's Gambit: vv--
Bookkeeper's Gambit: vv
}
Flock's Disintegration
Augur's Exaltation
Hermes' Gambit
}
```

**reference look, reference up, current look, current up → yaw, pitch**

Given reference and current look/up directions, returns the current yaw and pitch relative to the reference.

All inputs should be unit vectors, and the returned values are in radians. Yaw increases right, and pitch increases down.

To get the pitch/yaw from the F3 screen, use (0, 0, 1) and (0, 1, 0) as the reference look and up vectors respectively.

Required macros: Theta Exaltation

## Patterns

Code: Select all

```
#define Get Relative Angles (NORTH_EAST dwaaqqqqqedeewe) = vec, vec, vec, vec -> num, num
// reference look, reference up, current look, current up -> yaw, pitch
// Given reference and current look/up directions, returns the current yaw and pitch relative to the reference.
// All inputs should be unit vectors, and the returned values are in radians.
// Yaw increases right, and pitch increases down.
{
// right vectors
Numerical Reflection: 4
Dioscuri Gambit II
Bookkeeper's Gambit: v-v----
Division Distillation
Rotation Gambit II
Division Distillation
// yaw (angle between current right and reference right)
Gemini Decomposition
Rotation Gambit
Vector Reflection -Y
Theta Exaltation
// rotate current look about y axis to cancel out yaw
// note: yaw is positive clockwise, but rotations are positive counterclockwise
// so we don't need to negate the pitch for this
Rotation Gambit
Prospector's Gambit
Vector Reflection +Y
Jester's Gambit
Rotation Distillation
Jester's Gambit
Multiplication Distillation: Matrix
// pitch (angle between rotated current look and reference look)
Rotation Gambit
Numerical Reflection: 4
Fisherman's Gambit
Jester's Gambit
Theta Exaltation
}
```

Demo video

## Patterns

Code: Select all

```
{
// get current vectors
Mind's Reflection
Alidade's Purification
Mind's Reflection
Theodolite Purification
// get reference vectors, and save them if necessary
Genie Reflection: Memory
Gemini Decomposition
Augur's Purification
{
// if truthy
Flock's Disintegration
// if falsy
Bookkeeper's Gambit: v
Dioscuri Gambit
Dioscuri Gambit
Numerical Reflection: 2
Flock's Gambit
Genie Gambit
}
Speaker's Decomposition
Jester's Gambit
Augur's Exaltation
Hermes' Gambit
// draw particle at reference point
Prospector's Gambit
Numerical Reflection: 2
Multiplicative Distillation
Mind's Reflection
Compass' Purification
Additive Distillation
Particles
// get mouse pos
Numerical Reflection: 16
Swindler's Gambit
Mouse Input
// print mouse pos
Dioscuri Gambit
Numerical Reflection: 2
Flock's Gambit
Send Thought
// continue if out of bounds
Gemini Decomposition
Nullary Reflection
Equality Distillation
{
Charon's Gambit
Bookkeeper's Gambit: -
}
Flock's Disintegration
Augur's Exaltation
Hermes' Gambit
// draw particle at mouse pos
Genie Reflection: Memory
Flock's Disintegration
Dioscuri Gambit
Division Distillation
Numerical Reflection: 56 // edcba -> cdbea
Swindler's Gambit
Multiplicative Distillation
Rotation Gambit II
Multiplicative Distillation
Additive Distillation
Additive Distillation
Numerical Reflection: 2
Multiplicative Distillation
Mind's Reflection
Compass' Purification
Additive Distillation
Particles
}
```

Demo video

## Patterns

Code: Select all

```
{
// get (and set, if necessary) accumulators and reference vectors
Genie Reflection: Memory
Gemini Decomposition
Augur's Purification
{
// if truthy
Flock's Disintegration
// if falsy
Bookkeeper's Gambit: v
Numerical Reflection: 0
Numerical Reflection: 0
Mind's Reflection
Alidade's Purification
Mind's Reflection
Theodolite Purification
Numerical Reflection: 4
Dioscuri Gambit II
Numerical Reflection: 4
Flock's Gambit
Genie Gambit
}
Speaker's Decomposition
Jester's Gambit
Augur's Exaltation
Hermes' Gambit
// draw particle at reference point
Prospector's Gambit
Numerical Reflection: 2
Multiplicative Distillation
Mind's Reflection
Compass' Purification
Additive Distillation
Particles
// get mouse offset
Mind's Reflection
Alidade's Purification
Mind's Reflection
Theodolite Purification
Mouse Input
// continue if out of bounds
Gemini Decomposition
Nullary Reflection
Equality Distillation
{
Charon's Gambit
Bookkeeper's Gambit: -
}
Flock's Disintegration
Augur's Exaltation
Hermes' Gambit
// apply sensitivity
Numerical Reflection: 0
Vector Exaltation
Numerical Reflection: 0.5 // sensitivity
Multiplicative Distillation
// check for dead zone
Gemini Decomposition
Length Purification
Numerical Reflection: 1 // 1 degree from reference
Numerical Reflection: 90
Division Distillation
Maximus Distillation
Jester's Gambit
Vector Reflection Zero
Augur's Exaltation
Vector Disintegration
Bookkeeper's Gambit: v
// add offset to mouse pos
Rotation Gambit
Additive Distillation
Rotation Gambit II
Additive Distillation
Jester's Gambit
// print mouse pos
Dioscuri Gambit
Numerical Reflection: 2
Flock's Gambit
Send Thought
// update saved mouse pos
Genie Reflection: Memory
Flock's Disintegration
Bookkeeper's Gambit: vv--
Numerical Reflection: 4
Dioscuri Gambit II
Numerical Reflection: 4
Flock's Gambit
Genie Gambit
// draw particle at mouse pos
Dioscuri Gambit
Division Distillation
Numerical Reflection: 56 // edcba -> cdbea
Swindler's Gambit
Multiplicative Distillation
Rotation Gambit II
Multiplicative Distillation
Additive Distillation
Jester's Gambit
Numerical Reflection: 2
Multiplicative Distillation
Additive Distillation
Mind's Reflection
Compass' Purification
Additive Distillation
Particles
}
```