Class QuakeMap
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
Format
The format of the map (Standard or Valve).
public QuakeMapFormat Format { get; set; }
Property Value
Physics
Box3D world of static brush hulls. Null until BuildColliders().
public PhysicsWorld? Physics { get; }
Property Value
UnitScale
Quake-unit to engine-metre scale. 1 for authored .map, 1/32 for BSP29.
public float UnitScale { get; set; }
Property Value
Worldspawn
The worldspawn entity (the map geometry).
public QuakeMapEntity Worldspawn { get; }
Property Value
Methods
AddEntity(QuakeMapEntity)
Adds an entity to the map.
public void AddEntity(QuakeMapEntity entity)
Parameters
entityQuakeMapEntityThe 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
rayRay
Returns
- RayCollision
CheckSphereCollision(Vector3, float)
public bool CheckSphereCollision(Vector3 center, float radius)
Parameters
Returns
GetCollisionNormal(Vector3, float)
public Vector3 GetCollisionNormal(Vector3 center, float radius)
Parameters
Returns
GetEntitiesByClassName(string)
Gets all entities of a specific class name.
public List<QuakeMapEntity> GetEntitiesByClassName(string className)
Parameters
classNamestringThe 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
classNamestringThe 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
originVector3The origin of the ray.
directionVector3The direction of the ray.
maxDistancefloatThe maximum distance to check.
hitPointVector3The point where the ray hits the map geometry, if any.
hitNormalVector3The normal of the surface at the hit point, if any.
hitEntityQuakeMapEntityThe 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
quakeVector3
Returns
Unload()
Unloads all resources used by the map.
public void Unload()