Is some global axis rotation ahead of or behind us?

// Is some rotation forward or backwards? We can use the Dot Product to find out.
Vector3 forwardDir = Quaternion.Euler(0, rotation, 0) * Vector3.forward;
float directionalIndicator = Vector3.Dot(forwardDir, transform.forward);
if (directionalIndicator<0) print("behind us");

Comments

Popular posts from this blog

Why most companies post fake job offers. Often. Constantly.

Brain Script - The Ultimate Programming Language

Glycon 3D Motion Capture - History of the VR Based motion capture system