0
\$\begingroup\$

T<----------------------Q

While making a view matrix, I usually cross product a (0,1,0) with W TO GET U W = (T-Q)/||T-Q|| U = (W X (0,1,0)/||W X (0,1,0) v = w x u this works most of the time. But what about when I want to go y axis and look straight down at 0,0,0

What would be the value of the vector? (0,1,0) does not work. Tried every combination even negatives and didn't work.

\$\endgroup\$
  • 1
    \$\begingroup\$ I have zero idea what W, U, v, w , u, T and Q mean \$\endgroup\$ – Bálint Apr 30 '17 at 16:10
1
\$\begingroup\$

You can't. You have to change your "up" vector (0, 1, 0) to something else when you're pointing down or up.

There are many solutions to this that all depend on how you want it to look.

One solution is to "unlock" your camera's up vector once you reach a certain threshold and keep replacing (0, 1, 0) with your last up vector. When to transition between unlocking and re-locking your camera's up vector to (0, 1, 0) or (0, -1, 0) is up to you.

Some games just prevent you from getting too close to your up / down vector.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.