![]() news about forums links tools tutorials contact |
| Melee Weapon - author: Mr.Self-Destruct | |
Melee Weapons TraceShot actor TraceShot( out vector HitLoc, out vector HitNorm,
vector End, vector Start ); Returns the first actor touched by
the line traced from the Start point to the End point. HitLoc is set to
the hit location and HitNorm is set to an outward-pointing hit normal. Because it is only possible to "hit" one target this makes
it unsuitable for weapons where you'd like to be able to hit several
things at once, also it requires a high degree of accuracy on the users
part. Below is a demonstration of using TraceShot: TraceActors TraceActors( class BaseClass, out actor Actor, out
vector HitLoc, out vector HitNorm, vector End, optional vector Start,
option vector Extent ); Iterates through all actors which
touch a line traced from the Start point to the End point, using a box of
collision extent Extent. On each iteration HitLoc is set to the hit
location and HitNorm is set to an outward-pointing hit normal. So we have the capability to check what intersects a
definable cuboid: Of the three techniques in this tutorial, I would have to
say that I feel TraceActors is the best one. The main limitation is that
the Extent can only be a cuboid, and for example you may want to use an
arc. VisibleActors & Dot Product
VisibleActors( class BaseClas, out actor Actor, optional
float Radius, optional vector Loc ); Iterates through a list
of all actors who are visible to the specified location (or if no location
is specified, this actor's location). VisibleActors will iterate through a list of all visible
actors within a specified radius, but we only want to deal actors who're
within a specific area in front of the player. So we use dot product to
calculate the angle between where the player is aiming and where each
actor is located. Effectively we can filter out all actors apart from
those who lie in a definable arc in front of the player: VisibleActors & Dot Product is the most complicated
technique of the three and has a distinct disadvantage. The problem is
that HitLoc.Z always equals Other.Location.Z, so it's
impossible to have head shot detection. The main benefit of this technique
is that it affects an arc, as would sweeping a great big axe in front of
you. | |