Classes:LineTracer

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


LineTracer is a class that allows for custom ray tracing (aka hitscan) behavior. It uses the same tracing technique that LineTrace and LineAttack use but doesn't include any logic for handling what happens when it hits an Actor, Line, or plane. Instead this can be handled entirely by the modder allowing them to choose what information they want to retrieve from the ray trace. Similar to regular hitscan this is only capable of hitting Actors in the blockmap. It is also data-scoped meaning Actors hit in it cannot be directly modified from TraceCallback().

Fields

@TraceResults Results - A struct containing information that pertains to what caused the trace to call TraceCallback(). Its fields can be directly modified allowing for customized results.

  • Sector HitSector - The sector where the trace called TraceCallback()
  • TextureID HitTexture - The texture of the surface that got hit, if any
  • Vector3 HitPos - The absolute map coordinates where the trace called TraceCallback()
  • Vector3 HitVector - The direction the trace was traveling
  • Vector3 SrcFromTarget - The starting position of the trace
  • double SrcAngleFromTarget - The angle of HitVector
  • double Distance - The distance from the starting point the trace has traveled
  • double Fraction - The fraction of the total distance the trace has traveled
  • Actor HitActor - The Actor that was hit, if any
  • Line HitLine - The Line that was hit, if any
  • uint Side - Which side of the Line that was hit, if any. Can be one of the following:
  • Line.front
  • Line.back
  • uint Tier - Which part of the Line that was hit, if any. Can be one of the following:
  • TIER_Middle
  • TIER_Upper
  • TIER_Lower
  • TIER_FFloor (hit a line connected to a 3D floor)
  • bool unlinked - True if the trace passed through a portal that was not linked
  • ETraceResult HitType - What the trace hit, if anything. Can be one of the following:
  • TRACE_HitNone
  • TRACE_HitFloor
  • TRACE_HitCeiling
  • TRACE_HitWall
  • TRACE_HitActor
  • TRACE_CrossingPortal (requires portal reporting flag in Trace to be set)
  • TRACE_HasHitSky (requires hitting sky flag in Trace to be set)
  • F3DFloor ffloor - The 3D floor that got hit, if any
  • Sector CrossedWater - The sector the trace hit that contained Boom-style deep water, if any
  • Vector3 CrossedWaterPos - The absolute map coordinates where the trace hit CrossedWater
  • Sector Crossed3DWater - The sector the trace hit that contained 3D floor-style deep water, if any
  • Vector3 Crossed3DWaterPos - The absolute map coordinates where the trace hit Crossed3DWater

Methods

Virtual

Non-static

  • bool Trace(vector3 start, Sector sec, vector3 direction, double maxDist, ETraceFlags traceFlags)