Table of Contents

Class QuakeMap

Namespace
PopcorningGuineaPig.Engine.Quake
Assembly
PopcorningGuineaPig.Engine.dll

Represents a Quake map with entities and geometry.

public class QuakeMap
Inheritance
QuakeMap
Inherited Members

Constructors

QuakeMap()

Creates a new empty Quake map.

public QuakeMap()

Properties

Entities

The entities in the map.

public List<QuakeMapEntity> Entities { get; set; }

Property Value

List<QuakeMapEntity>

Format

The format of the map (Standard or Valve).

public QuakeMapFormat Format { get; set; }

Property Value

QuakeMapFormat

Physics

Box3D world of static brush hulls. Null until BuildColliders().

public PhysicsWorld? Physics { get; }

Property Value

PhysicsWorld

UnitScale

Quake-unit to engine-metre scale. 1 for authored .map, 1/32 for BSP29.

public float UnitScale { get; set; }

Property Value

float

Worldspawn

The worldspawn entity (the map geometry).

public QuakeMapEntity Worldspawn { get; }

Property Value

QuakeMapEntity

Methods

AddEntity(QuakeMapEntity)

Adds an entity to the map.

public void AddEntity(QuakeMapEntity entity)

Parameters

entity QuakeMapEntity

The entity to add.

BuildColliders()

Bake every brush into a static Box3D hull. Quake Z-up becomes engine Y-up.

public void BuildColliders()

CheckCollision(Ray)

Closest hit along a ray. Direction need not be unit length.

public RayCollision CheckCollision(Ray ray)

Parameters

ray Ray

Returns

RayCollision

CheckSphereCollision(Vector3, float)

public bool CheckSphereCollision(Vector3 center, float radius)

Parameters

center Vector3
radius float

Returns

bool

GetCollisionNormal(Vector3, float)

public Vector3 GetCollisionNormal(Vector3 center, float radius)

Parameters

center Vector3
radius float

Returns

Vector3

GetEntitiesByClassName(string)

Gets all entities of a specific class name.

public List<QuakeMapEntity> GetEntitiesByClassName(string className)

Parameters

className string

The class name to search for.

Returns

List<QuakeMapEntity>

A list of entities with the specified class name.

GetEntityByClassName(string)

Gets the first entity of a specific class name.

public QuakeMapEntity GetEntityByClassName(string className)

Parameters

className string

The class name to search for.

Returns

QuakeMapEntity

The first entity with the specified class name, or null if none is found.

ProcessForRendering()

Processes the map for rendering.

public void ProcessForRendering()

Remarks

This method converts the map data into renderable geometry. It should be called before rendering the map.

RayCast(Vector3, Vector3, float, out Vector3, out Vector3, out QuakeMapEntity)

Performs a ray cast against the map geometry.

public bool RayCast(Vector3 origin, Vector3 direction, float maxDistance, out Vector3 hitPoint, out Vector3 hitNormal, out QuakeMapEntity hitEntity)

Parameters

origin Vector3

The origin of the ray.

direction Vector3

The direction of the ray.

maxDistance float

The maximum distance to check.

hitPoint Vector3

The point where the ray hits the map geometry, if any.

hitNormal Vector3

The normal of the surface at the hit point, if any.

hitEntity QuakeMapEntity

The entity that was hit, if any.

Returns

bool

True if the ray hits something, false otherwise.

Render()

Renders the map.

public void Render()

Remarks

This method renders the map geometry and entities. It should be called in the scene's render method.

ToEngine(Vector3)

Quake Z-up → engine Y-up, then UnitScale.

public Vector3 ToEngine(Vector3 quake)

Parameters

quake Vector3

Returns

Vector3

Unload()

Unloads all resources used by the map.

public void Unload()