Game.Common.RaycastFlags
Assembly: Assembly-CSharp
Namespace: Game.Common
Type: public enum
Base: System.Enum (underlying type: System.UInt32)
Summary: RaycastFlags is a bitmask enum used to control what categories of objects are considered or ignored when performing raycasts in the game (selection, tool hits, editor queries, etc.). The Flags attribute allows combining multiple values with bitwise operations so callers can include or exclude specific sets of scene elements when performing ray intersection tests. Typical uses include filtering out UI/debug/tool objects, including sub-elements or decals, or toggling handling of outside connections and building lots for various editor/tool behaviors.
Fields
-
DebugDisable = 1uExclude debug objects and gizmos from raycasts (ignore debug-only visuals). -
UIDisable = 2uIgnore UI elements so on-screen UI won't block or be hit by the raycast. -
ToolDisable = 4uIgnore tool-related objects (tools and their temporary geometry) during ray tests. -
FreeCameraDisable = 8uExclude objects related to the free camera mode (used when free camera is active). -
ElevateOffset = 0x10uApply an elevation offset in ray tests — typically used to handle elevated structures or offset snapping. -
SubElements = 0x20uInclude or consider sub-elements (for example lanes, sub-nodes, or smaller parts of a larger object). -
Placeholders = 0x40uInclude placeholder objects (temporary/ghost placements) in ray intersection results. -
Markers = 0x80uInclude marker objects (map markers, placement markers) in raycasts. -
NoMainElements = 0x100uExclude main elements, meaning only secondary/sub elements are considered. -
UpgradeIsMain = 0x200uTreat upgrade elements as main elements for the purposes of the raycast. -
OutsideConnections = 0x400uInclude outside-connection objects (connections to external maps or modules). -
Outside = 0x800uInclude outside-level objects/entities in ray tests. -
Cargo = 0x1000uInclude cargo-related objects/entities in the raycast. -
Passenger = 0x2000uInclude passenger-related objects/entities in the raycast. -
Decals = 0x4000uInclude decals (surface textures, road markings, etc.) in ray intersection tests. -
EditorContainers = 0x8000uInclude editor-specific containers (used in map/asset editors) during raycasts. -
SubBuildings = 0x10000uInclude sub-buildings or attached building parts in ray tests. -
PartialSurface = 0x20000uConsider partial surfaces (non-full-solid surfaces) when performing raycasts. -
BuildingLots = 0x40000uInclude building lot areas/markers in ray intersection results. -
IgnoreSecondary = 0x80000uIgnore secondary elements (the inverse/compliment to flags that include secondaries).
Properties
- None (enum type — use static values listed above).
Constructors
- None (enum type — values are defined above).
Methods
- None (enum type — no methods defined here).
Usage Example
// Combine flags with bitwise OR
RaycastFlags flags = RaycastFlags.SubElements | RaycastFlags.Decals | RaycastFlags.Placeholders;
// Check whether a particular flag is set (bitwise check is preferred for performance)
bool includeDecals = (flags & RaycastFlags.Decals) != 0;
// Clear a flag
flags &= ~RaycastFlags.Decals;
// Set a flag
flags |= RaycastFlags.Decals;
// Alternative (clearer but slightly slower): using Enum.HasFlag
bool hasDecals = flags.HasFlag(RaycastFlags.Decals);
// Example hypothetical raycast call (actual API may differ)
RaycastFlags query = RaycastFlags.SubElements | RaycastFlags.SubBuildings;
RaycastHit hit;
bool result = RaycastManager.Raycast(cameraRay, out hit, query); // pseudo-API: pass flags to raycast
// Use cases:
// - Exclude UI/debug: RaycastFlags.UIDisable | RaycastFlags.DebugDisable
// - Editor selection: include Placeholders, EditorContainers, BuildingLots, SubElements
Notes: - Because this is a [Flags] enum, values are bit flags (powers of two) and should be combined with bitwise operators. - For performance-sensitive code (e.g., per-frame raycasts), prefer bitwise (&) checks over Enum.HasFlag.