CCollisionProperty
An entity's bounds and collision settings: what it collides with, what traces hit it, and its physics shape. Get it with CBaseEntity.Collision.
public class CCollisionProperty : NativeEntity
Namespace: DeadworksManaged.Api
Inherits / implements: NativeEntity
Source: Entities/CCollisionProperty.cs#L13
Notes
Two things collide when either one's InteractsWith overlaps the other's InteractsAs, unless either one's InteractsExclude overlaps the other's InteractsAs.
Properties
CCollisionProperty.IsValid
True if the pointer is non-null.
Signature
public override bool IsValid { get; }
Source: Entities/CCollisionProperty.cs#L34
CCollisionProperty.Owner
The owning entity.
Signature
public CBaseEntity Owner { get; }
Source: Entities/CCollisionProperty.cs#L37
CCollisionProperty.Mins
Lower OBB corner in local space.
Signature
public Vector3 Mins { get; set; }
Source: Entities/CCollisionProperty.cs#L40
CCollisionProperty.Maxs
Upper OBB corner in local space.
Signature
public Vector3 Maxs { get; set; }
Source: Entities/CCollisionProperty.cs#L43
CCollisionProperty.BoundingRadius
Signature
public float BoundingRadius { get; }
Source: Entities/CCollisionProperty.cs#L45
CCollisionProperty.WorldMins
Mins in world space (local Mins + owner's AbsOrigin). Assumes identity rotation.
Signature
public Vector3 WorldMins { get; }
Source: Entities/CCollisionProperty.cs#L48
CCollisionProperty.WorldMaxs
Maxs in world space (local Maxs + owner's AbsOrigin). Assumes identity rotation.
Signature
public Vector3 WorldMaxs { get; }
Source: Entities/CCollisionProperty.cs#L51
CCollisionProperty.Attribute
All of the entity's collision attributes in one read.
Signature
public RnCollisionAttr_t Attribute { get; }
Source: Entities/CCollisionProperty.cs#L57
CCollisionProperty.InteractsAs
Layers the entity belongs to, such as InteractionLayer.Solid.
Signature
public InteractionLayer InteractsAs { get; }
Source: Entities/CCollisionProperty.cs#L60
CCollisionProperty.InteractsWith
Layers the entity collides with.
Signature
public InteractionLayer InteractsWith { get; }
Source: Entities/CCollisionProperty.cs#L63
CCollisionProperty.InteractsExclude
Layers that never collide with the entity. Wins over InteractsAs, InteractsWith and the collision group.
Signature
public InteractionLayer InteractsExclude { get; }
Source: Entities/CCollisionProperty.cs#L66
CCollisionProperty.CollisionGroup
The entity's collision group. Change it with SetCollisionGroup.
Signature
public CollisionGroup CollisionGroup { get; }
Source: Entities/CCollisionProperty.cs#L100
CCollisionProperty.SolidType
The shape the entity's physics body is built from. Change it with SetSolid.
Signature
public SolidType SolidType { get; }
Source: Entities/CCollisionProperty.cs#L110
CCollisionProperty.SolidFlags
The entity's solid flags. Change them with SetSolidFlags.
Signature
public SolidFlags SolidFlags { get; }
Source: Entities/CCollisionProperty.cs#L120
CCollisionProperty.CollisionFunctions
Which collision functions are on. Toggle the main three with EnableCollision and DisableCollision.
Signature
public CollisionFunctionMask_t CollisionFunctions { get; }
Source: Entities/CCollisionProperty.cs#L127
Methods
CCollisionProperty.Contains()
Returns true if point lies within the entity's world-space AABB (inclusive).
Signature
public bool Contains(Vector3 point)
Source: Entities/CCollisionProperty.cs#L54
CCollisionProperty.AddInteractsAs()
Adds layers to InteractsAs.
Signature
public void AddInteractsAs(InteractionLayer layers)
Source: Entities/CCollisionProperty.cs#L70
CCollisionProperty.RemoveInteractsAs()
Removes layers from InteractsAs.
Signature
public void RemoveInteractsAs(InteractionLayer layers)
Source: Entities/CCollisionProperty.cs#L74
CCollisionProperty.AddInteractsWith()
Adds layers to InteractsWith.
Signature
public void AddInteractsWith(InteractionLayer layers)
Source: Entities/CCollisionProperty.cs#L78
CCollisionProperty.RemoveInteractsWith()
Removes layers from InteractsWith.
Signature
public void RemoveInteractsWith(InteractionLayer layers)
Source: Entities/CCollisionProperty.cs#L82
CCollisionProperty.AddInteractsExclude()
Adds layers to InteractsExclude, so nothing on those layers collides with the entity.
Signature
public void AddInteractsExclude(InteractionLayer layers)
Example Let shots pass through a prop that players still collide with:
prop.Collision?.AddInteractsExclude(InteractionLayer.CitadelBullet | InteractionLayer.CitadelAbility);
Notes
Takes effect immediately and survives CBaseEntity.SetModel. Call it after the entity spawns. On heroes and other units, the game resets the team, bullet and ability layers whenever it sets their team.
Source: Entities/CCollisionProperty.cs#L93
CCollisionProperty.RemoveInteractsExclude()
Removes layers from InteractsExclude.
Signature
public void RemoveInteractsExclude(InteractionLayer layers)
Source: Entities/CCollisionProperty.cs#L97
CCollisionProperty.SetCollisionGroup()
Moves the entity to another collision group. Takes effect immediately.
Signature
public void SetCollisionGroup(CollisionGroup group)
Notes
Also updates InteractsAs: Api.CollisionGroup.Debris adds InteractionLayer.Debris, and most other groups add InteractionLayer.TouchAll.
Source: Entities/CCollisionProperty.cs#L107
CCollisionProperty.SetSolid()
Changes the shape the entity's physics body is built from.
Signature
public void SetSolid(SolidType type)
Notes
Only applies when the physics body is rebuilt, which happens when CBaseEntity.SetModel is called with a different model.
Source: Entities/CCollisionProperty.cs#L117
CCollisionProperty.SetSolidFlags()
Replaces the entity's solid flags. Takes effect immediately.
Signature
public void SetSolidFlags(SolidFlags flags)
Notes
To keep the current flags, combine them: collision.SetSolidFlags(collision.SolidFlags | SolidFlags.NotStandable).
Source: Entities/CCollisionProperty.cs#L124
CCollisionProperty.EnableCollision()
Turns solid contact, traces and touch events back on after DisableCollision.
Signature
public void EnableCollision()
Source: Entities/CCollisionProperty.cs#L130
CCollisionProperty.DisableCollision()
Turns off solid contact, traces and touch events, so players, bullets and triggers all pass through the entity.
Signature
public void DisableCollision()
Notes
To let only some things through, use AddInteractsExclude. To ignore one entity, use CBaseEntity.DisableCollisionsWith.