|
|
|
|
@ -64,7 +64,7 @@ namespace RayTraceAPI
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 32)]
|
|
|
|
|
public struct TraceOptions
|
|
|
|
|
public unsafe struct TraceOptions
|
|
|
|
|
{
|
|
|
|
|
[FieldOffset(0)] public ulong InteractsAs;
|
|
|
|
|
[FieldOffset(8)] public ulong InteractsWith;
|
|
|
|
|
@ -89,10 +89,10 @@ namespace RayTraceAPI
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Size = 8)]
|
|
|
|
|
public struct CUtlString
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 8)]
|
|
|
|
|
public unsafe struct CUtlString
|
|
|
|
|
{
|
|
|
|
|
public nint _ptr; // make public so Marshal sees it
|
|
|
|
|
[FieldOffset(0)] public nint _ptr; // make public so Marshal sees it
|
|
|
|
|
|
|
|
|
|
public string Value
|
|
|
|
|
{
|
|
|
|
|
@ -106,20 +106,22 @@ namespace RayTraceAPI
|
|
|
|
|
public static implicit operator string(CUtlString s) => s.Value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct CPhysSurfacePropertiesTrace
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 200)]
|
|
|
|
|
public unsafe struct CPhysSurfacePropertiesTrace
|
|
|
|
|
{
|
|
|
|
|
public CUtlString Name;
|
|
|
|
|
public uint NameHash;
|
|
|
|
|
public uint BaseNameHash;
|
|
|
|
|
public int ListIndex;
|
|
|
|
|
public int BaseListIndex;
|
|
|
|
|
[MarshalAs(UnmanagedType.I1)]
|
|
|
|
|
[FieldOffset(0)] public CUtlString Name;
|
|
|
|
|
[FieldOffset(8)] public uint NameHash;
|
|
|
|
|
[FieldOffset(12)] public uint BaseNameHash;
|
|
|
|
|
[FieldOffset(16)] public int ListIndex;
|
|
|
|
|
[FieldOffset(20)] public int BaseListIndex;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.I1)] [FieldOffset(24)]
|
|
|
|
|
public bool Hidden;
|
|
|
|
|
public CUtlString Description;
|
|
|
|
|
public CPhysSurfacePropertiesPhysicsTrace Physics;
|
|
|
|
|
public CPhysSurfacePropertiesSoundNamesTrace AudioSounds;
|
|
|
|
|
public CPhysSurfacePropertiesAudioTrace AudioParams;
|
|
|
|
|
|
|
|
|
|
[FieldOffset(32)] public CUtlString Description;
|
|
|
|
|
[FieldOffset(40)] public CPhysSurfacePropertiesPhysicsTrace Physics;
|
|
|
|
|
[FieldOffset(80)] public CPhysSurfacePropertiesSoundNamesTrace AudioSounds;
|
|
|
|
|
[FieldOffset(168)] public CPhysSurfacePropertiesAudioTrace AudioParams;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum CollisionFunctionMask_t : byte
|
|
|
|
|
@ -132,17 +134,17 @@ namespace RayTraceAPI
|
|
|
|
|
FCOLLISION_FUNC_ENABLE_TOUCH_PERSISTS = (1 << 5),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct RnCollisionAttr_t
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 48)]
|
|
|
|
|
public unsafe struct RnCollisionAttr_t
|
|
|
|
|
{
|
|
|
|
|
public ulong InteractsAs;
|
|
|
|
|
public ulong InteractsWith;
|
|
|
|
|
public ulong InteractsExclude;
|
|
|
|
|
public uint EntityId;
|
|
|
|
|
public uint OwnerId;
|
|
|
|
|
public ushort HierarchyId;
|
|
|
|
|
public CollisionGroup CollisionGroup;
|
|
|
|
|
public CollisionFunctionMask_t CollisionFunctionMask;
|
|
|
|
|
[FieldOffset(0)] public ulong InteractsAs;
|
|
|
|
|
[FieldOffset(8)] public ulong InteractsWith;
|
|
|
|
|
[FieldOffset(16)] public ulong InteractsExclude;
|
|
|
|
|
[FieldOffset(24)] public uint EntityId;
|
|
|
|
|
[FieldOffset(28)] public uint OwnerId;
|
|
|
|
|
[FieldOffset(32)] public ushort HierarchyId;
|
|
|
|
|
[FieldOffset(36)] public CollisionGroup CollisionGroup;
|
|
|
|
|
[FieldOffset(40)] public CollisionFunctionMask_t CollisionFunctionMask;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum RayType_t : byte
|
|
|
|
|
@ -154,53 +156,53 @@ namespace RayTraceAPI
|
|
|
|
|
RAY_TYPE_MESH,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct CPhysSurfacePropertiesPhysicsTrace
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 36)]
|
|
|
|
|
public unsafe struct CPhysSurfacePropertiesPhysicsTrace
|
|
|
|
|
{
|
|
|
|
|
public float Friction;
|
|
|
|
|
public float Elasticity;
|
|
|
|
|
public float Density;
|
|
|
|
|
public float Thickness;
|
|
|
|
|
public float SoftContactFrequency;
|
|
|
|
|
public float SoftContactDampingRatio;
|
|
|
|
|
public float WheelDrag;
|
|
|
|
|
public float HeatConductivity;
|
|
|
|
|
public float Flashpoint;
|
|
|
|
|
[FieldOffset(0)] public float Friction;
|
|
|
|
|
[FieldOffset(4)] public float Elasticity;
|
|
|
|
|
[FieldOffset(8)] public float Density;
|
|
|
|
|
[FieldOffset(12)] public float Thickness;
|
|
|
|
|
[FieldOffset(16)] public float SoftContactFrequency;
|
|
|
|
|
[FieldOffset(20)] public float SoftContactDampingRatio;
|
|
|
|
|
[FieldOffset(24)] public float WheelDrag;
|
|
|
|
|
[FieldOffset(28)] public float HeatConductivity;
|
|
|
|
|
[FieldOffset(32)] public float Flashpoint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct CPhysSurfacePropertiesSoundNamesTrace
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 88)]
|
|
|
|
|
public unsafe struct CPhysSurfacePropertiesSoundNamesTrace
|
|
|
|
|
{
|
|
|
|
|
public CUtlString ImpactSoft;
|
|
|
|
|
public CUtlString ImpactHard;
|
|
|
|
|
public CUtlString ScrapeSmooth;
|
|
|
|
|
public CUtlString ScrapeRough;
|
|
|
|
|
public CUtlString BulletImpact;
|
|
|
|
|
public CUtlString Rolling;
|
|
|
|
|
public CUtlString Break;
|
|
|
|
|
public CUtlString Strain;
|
|
|
|
|
public CUtlString MeleeImpact;
|
|
|
|
|
public CUtlString PushOff;
|
|
|
|
|
public CUtlString SkidStop;
|
|
|
|
|
[FieldOffset(0)] public CUtlString ImpactSoft;
|
|
|
|
|
[FieldOffset(8)] public CUtlString ImpactHard;
|
|
|
|
|
[FieldOffset(16)] public CUtlString ScrapeSmooth;
|
|
|
|
|
[FieldOffset(24)] public CUtlString ScrapeRough;
|
|
|
|
|
[FieldOffset(32)] public CUtlString BulletImpact;
|
|
|
|
|
[FieldOffset(40)] public CUtlString Rolling;
|
|
|
|
|
[FieldOffset(48)] public CUtlString Break;
|
|
|
|
|
[FieldOffset(56)] public CUtlString Strain;
|
|
|
|
|
[FieldOffset(64)] public CUtlString MeleeImpact;
|
|
|
|
|
[FieldOffset(72)] public CUtlString PushOff;
|
|
|
|
|
[FieldOffset(80)] public CUtlString SkidStop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct CPhysSurfacePropertiesAudioTrace
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 32)]
|
|
|
|
|
public unsafe struct CPhysSurfacePropertiesAudioTrace
|
|
|
|
|
{
|
|
|
|
|
public float Reflectivity;
|
|
|
|
|
public float HardnessFactor;
|
|
|
|
|
public float RoughnessFactor;
|
|
|
|
|
public float RoughThreshold;
|
|
|
|
|
public float HardThreshold;
|
|
|
|
|
public float HardVelocityThreshold;
|
|
|
|
|
public float StaticImpactVolume;
|
|
|
|
|
public float OcclusionFactor;
|
|
|
|
|
[FieldOffset(0)] public float Reflectivity;
|
|
|
|
|
[FieldOffset(4)] public float HardnessFactor;
|
|
|
|
|
[FieldOffset(8)] public float RoughnessFactor;
|
|
|
|
|
[FieldOffset(12)] public float RoughThreshold;
|
|
|
|
|
[FieldOffset(16)] public float HardThreshold;
|
|
|
|
|
[FieldOffset(20)] public float HardVelocityThreshold;
|
|
|
|
|
[FieldOffset(24)] public float StaticImpactVolume;
|
|
|
|
|
[FieldOffset(28)] public float OcclusionFactor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct CUtlStringToken : IEquatable<CUtlStringToken>
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 4)]
|
|
|
|
|
public unsafe struct CUtlStringToken : IEquatable<CUtlStringToken>
|
|
|
|
|
{
|
|
|
|
|
private uint _hashCode;
|
|
|
|
|
[FieldOffset(0)] private uint _hashCode;
|
|
|
|
|
|
|
|
|
|
public CUtlStringToken(uint hashCode)
|
|
|
|
|
{
|
|
|
|
|
@ -239,34 +241,34 @@ namespace RayTraceAPI
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public struct CHitBox
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Size = 104)]
|
|
|
|
|
public unsafe struct CHitBox
|
|
|
|
|
{
|
|
|
|
|
public CUtlString m_name; // pointer to CUtlString
|
|
|
|
|
public CUtlString m_sSurfaceProperty; // pointer to CUtlString
|
|
|
|
|
public CUtlString m_sBoneName; // pointer to CUtlString
|
|
|
|
|
[FieldOffset(0)] public CUtlString m_name; // pointer to CUtlString
|
|
|
|
|
[FieldOffset(8)] public CUtlString m_sSurfaceProperty; // pointer to CUtlString
|
|
|
|
|
[FieldOffset(16)] public CUtlString m_sBoneName; // pointer to CUtlString
|
|
|
|
|
|
|
|
|
|
public Vector3 m_vMinBounds; // blittable
|
|
|
|
|
public Vector3 m_vMaxBounds; // blittable
|
|
|
|
|
public float m_flShapeRadius;
|
|
|
|
|
[FieldOffset(24)] public Vector3 m_vMinBounds; // blittable
|
|
|
|
|
[FieldOffset(36)] public Vector3 m_vMaxBounds; // blittable
|
|
|
|
|
[FieldOffset(48)] public float m_flShapeRadius;
|
|
|
|
|
|
|
|
|
|
public CUtlStringToken m_nBoneNameHash; // pointer or uint
|
|
|
|
|
[FieldOffset(52)] public CUtlStringToken m_nBoneNameHash; // pointer or uint
|
|
|
|
|
|
|
|
|
|
public byte m_nShapeType;
|
|
|
|
|
public bool m_bTranslationOnly;
|
|
|
|
|
public uint m_CRC;
|
|
|
|
|
public uint m_cRenderColor;
|
|
|
|
|
public ushort m_nHitBoxIndex;
|
|
|
|
|
public bool m_bForcedTransform;
|
|
|
|
|
[FieldOffset(56)] public byte m_nShapeType;
|
|
|
|
|
[FieldOffset(57)] public bool m_bTranslationOnly;
|
|
|
|
|
[FieldOffset(60)] public uint m_CRC;
|
|
|
|
|
[FieldOffset(64)] public uint m_cRenderColor;
|
|
|
|
|
[FieldOffset(68)] public ushort m_nHitBoxIndex;
|
|
|
|
|
[FieldOffset(70)] public bool m_bForcedTransform;
|
|
|
|
|
|
|
|
|
|
public CTransform m_forcedTransform; // only if blittable (no managed types inside)
|
|
|
|
|
[FieldOffset(72)] public CTransform m_forcedTransform; // only if blittable (no managed types inside)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 16)]
|
|
|
|
|
public struct CTransform
|
|
|
|
|
[StructLayout(LayoutKind.Explicit, Pack = 16, Size = 32)]
|
|
|
|
|
public unsafe struct CTransform
|
|
|
|
|
{
|
|
|
|
|
public Vector4 Position; // VectorAligned: use Vector4 for 16-byte alignment
|
|
|
|
|
public System.Numerics.Quaternion Orientation;
|
|
|
|
|
[FieldOffset(0)] public Vector4 Position; // VectorAligned: use Vector4 for 16-byte alignment
|
|
|
|
|
[FieldOffset(16)] public System.Numerics.Quaternion Orientation;
|
|
|
|
|
|
|
|
|
|
public CTransform(Vector3 position, System.Numerics.Quaternion orientation)
|
|
|
|
|
{
|
|
|
|
|
@ -331,8 +333,8 @@ namespace RayTraceAPI
|
|
|
|
|
|
|
|
|
|
[FieldOffset(56)] public int TriangleIndex;
|
|
|
|
|
[FieldOffset(60)] public int HitboxBoneIndex;
|
|
|
|
|
[FieldOffset(64)] public int Contents;
|
|
|
|
|
[FieldOffset(68)] public int RayType;
|
|
|
|
|
[FieldOffset(64)] public InteractionLayers Contents;
|
|
|
|
|
[FieldOffset(68)] public RayType_t RayType;
|
|
|
|
|
[FieldOffset(72)] public int AllSolid;
|
|
|
|
|
[FieldOffset(76)] public int ExactHitPoint;
|
|
|
|
|
|
|
|
|
|
@ -342,7 +344,6 @@ namespace RayTraceAPI
|
|
|
|
|
[FieldOffset(104)] public nint BodyHandle;
|
|
|
|
|
[FieldOffset(112)] public nint ShapeHandle;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[FieldOffset(128)] public CTransform BodyTransform;
|
|
|
|
|
[FieldOffset(160)] public RnCollisionAttr_t ShapeAttributes;
|
|
|
|
|
|
|
|
|
|
@ -362,14 +363,21 @@ namespace RayTraceAPI
|
|
|
|
|
=> HitboxHandle == 0 ? default : Marshal.PtrToStructure<CHitBox>(HitboxHandle);
|
|
|
|
|
|
|
|
|
|
public CPhysSurfacePropertiesTrace SurfaceProps
|
|
|
|
|
=> SurfacePropsHandle == 0 ? default : Marshal.PtrToStructure<CPhysSurfacePropertiesTrace>(SurfacePropsHandle);
|
|
|
|
|
=> SurfacePropsHandle == 0
|
|
|
|
|
? default
|
|
|
|
|
: Marshal.PtrToStructure<CPhysSurfacePropertiesTrace>(SurfacePropsHandle);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public interface CRayTraceInterface
|
|
|
|
|
{
|
|
|
|
|
public unsafe bool TraceShape(Vector origin, QAngle angles, CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result);
|
|
|
|
|
public unsafe bool TraceEndShape(Vector origin, Vector endOrigin, CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result);
|
|
|
|
|
public unsafe bool TraceHullShape(Vector vecStart, Vector vecEnd, Vector hullMins, Vector hullMaxs, CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result);
|
|
|
|
|
public unsafe bool TraceShape(Vector origin, QAngle angles, CBaseEntity? ignoreEntity, TraceOptions options,
|
|
|
|
|
out TraceResult result);
|
|
|
|
|
|
|
|
|
|
public unsafe bool TraceEndShape(Vector origin, Vector endOrigin, CBaseEntity? ignoreEntity,
|
|
|
|
|
TraceOptions options, out TraceResult result);
|
|
|
|
|
|
|
|
|
|
public unsafe bool TraceHullShape(Vector vecStart, Vector vecEnd, Vector hullMins, Vector hullMaxs,
|
|
|
|
|
CBaseEntity? ignoreEntity, TraceOptions options, out TraceResult result);
|
|
|
|
|
}
|
|
|
|
|
}
|