# Houdini - Orientation

### How Houdini determines orientation

Houdini searches for these attributes, in this order. It goes down this list until none is found.

`@orient`

attribute. Use this to orient copy/instances.- Using
`@N`

as the Z-axis and`+Y`

is up. - Use
`@v`

e.g. velocity. - If
`@rot`

exists, apply it to the above.

### Copy to Points

We have a point with `@N = {0, 1, 0}`

e.g. its normal pointing up (the yellow trail). When the girl gets copied to the point, this happens because *her* z-axis is being aligned with `@N`

(according to rule #2 above).

To get her standing up *from this position*, we have to rotate the top of her head (*her* y-axis) to align with `@N`

.

To get this *rotation matrix* – e.g. the matrix that rotates her y-axis to `@N`

– we use the dihedral function.

```
vector from = {0, 1, 0};
vector to = @N;
@orient = dihedral(from, to);
```

Here’s a “platform” – yellow is `@N`

and green is `@P`

visualized as a vector. When we copy the girl to the platform we get this (as expected).

What we want is her standing up and facing out, along the `@P`

vector. In this case, we want to rotate her z-axis to align with `@P`

.

```
vector from = {0, 0, 1}; // her z-axis
vector to = @P;
@orient = dihedral(from, to);
```

Which brings us to:

We have a box with `@N`

vectors extending straight out from the center of each face.

If we want her standing *on* those faces, we have to align the top of her head – her y-axis – to `@N`

.

```
@orient = dihedral({0,1,0}, @N);
```

Which gets us: