Which Direction Does The Normal Go And Why?

So at the code block at the bottom of the tick function i’m confused because i don’t know whether the normal would be facing backwards or fowards and why would it be if so

It goes in whichever direction ActorVelocity is going. That’s what normalising a vector does.

A vector has both size/length/magnitude and direction. Normalising a vector means to get the same vector but with a length of 1, effectively removing the length. That is done by simple Pythagoras’ Theorem to calculate the length, then divide each component of the vector by that length

If ActorVelocity is (1, 2, 3) then that is

size² = 1² + 2² + 3² = 1 + 4 + 9 = 14
size =  √14
size  = 3.74165738677

Then to normalise:

X = 1 / 3.74165738677 = 0.26726124191
Y = 2 / 3.74165738677 = 0.53452248382
Z = 3 / 3.74165738677 = 0.80178372573

Now that is a vector that is going in the exact same direction as (1,2,3) but with the length of one. If you were to do Pythagoras on those numbers you would get roughly 1.

Using Sam’s numbers (I believe) of (0, 900, 0) then that will effectively just end up dividing by 900 - feel free to plug it into the above steps - so you would get (0, 1, 0).

However on line 33 note that the vector is then negated so now it’s (0, -900, 0) which would be normalised to (0, -1, 0).

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms