What it does
Computes a rotation that takes a chosen up vector onto each point normal and stores it as a quaternion in @orient. Copy to Points reads @orient automatically, so every copy is aimed along @N.
When to use it
Use it whenever copies need to follow the surface - grass and fur along normals, panels on a hull, arrows along a flow. Driving orientation with @orient avoids the gimbal and flipping problems you get from feeding @N and @up loosely.
The VEX code
// Aim each point's up vector along its normal; copies read p@orient.
vector up = {0, 1, 0};
matrix3 m = dihedral(up, normalize(@N));
p@orient = quaternion(m);
Inputs and assumptions
- Points with a normal
@N(add a Normal SOP or compute it first). @orientis a vector4 quaternion; thep@prefix declares it correctly.- Runs on the target points, before Copy to Points.
Common mistakes
- No
@Non the points, sodihedralhas nothing to aim at - compute normals first. - Not normalising
@N;dihedralexpects unit vectors. - Declaring
@orientas the wrong type - it must be a vector4 (p@orient), not a vector. - Also feeding
@N/@upto Copy to Points at the same time; let@orientown the rotation to avoid conflicts.
Frequently asked questions
What attribute rotates copy to points?
A vector4 quaternion named @orient. Copy to Points reads it automatically and uses it as each copy rotation, which is more robust than @N and @up alone.
What does dihedral do?
dihedral returns the shortest rotation that takes one vector onto another - here, taking the up vector onto the point normal so copies aim along the surface.