Question

Discussions about Coding and Scripting
User avatar
>@tack!<
Adept
Posts: 338
Joined: Sat Apr 17, 2010 4:51 pm
Personal rank: lol?

Question

Post by >@tack!< »

What does HitNormal do? i just cant understand it and i need my Hiteffect to rotate the right way :) thx
( Normal(rotator) makes the values of the rotator between 0-65536?)
User avatar
Feralidragon
Godlike
Posts: 5502
Joined: Wed Feb 27, 2008 6:24 pm
Personal rank: Work In Progress
Location: Liandri

Re: Question

Post by Feralidragon »

HitNormal by itself does nothing (it's not a function or anything like that).

HitNormal as a local variable, is most the times (or should be) a vector that represents the Normal vector of the hit itself (a vector of lenght = 1).

Basically if a projectile or a trace hits a wall, the HitNormal value is the inclination of that wall, in case of another actor, it depends of the projectile/trace code itself (it might represent the direction of the previous speed, the direction from the actor origin to the actual hit point, or anything else).

Normal(rotator) won't work and it doesn't even make sense. Normal(vector v) is a function that returns the normal vector from a given vector.

In case you want something to rotate to the direction of HitNormal, you must do something like this:
YourRotationVariable = rotator(HitNormal);

rotator(vector) makes the conversion of a vector direction to an actual rotation, while vector(rotator) does the other way around.

The HitNormal value is used to spawn things 1 unit out the wall the actor hit (to ensure a good rendering of the actor, in case it's a plane, otherwise it might flicker with the BSP surface), or even to give a rotation depending on the wall inclination (like the hit effect of the enforcer, or the ring of the instagib, for example).


If you still have any doubt regarding it, let us know.

EDIT: Here's an image showing it:
HitNormal.png
You do not have the required permissions to view the files attached to this post.