codeAPI Reference
TraceAttackInfo record struct
TraceAttackInfo Record Struct
Information about a trace-based attack in s&box, used to pass attack data through the weapon system.
Properties
- Target (GameObject) - The GameObject that was hit
- Damage (float) - Amount of damage to deal
- Tags (TagSet) - Damage tags to apply
- Position (Vector3) - Hit position in world space
- Origin (Vector3) - Origin of the attack trace
- Hitbox (Hitbox) - The hitbox that was hit (if applicable)
Methods
From
Creates a TraceAttackInfo from a SceneTraceResult and damage amount.CSHARP
public static TraceAttackInfo From( SceneTraceResult tr, float damage, TagSet tags = default, bool localise = true )When localise is true, hitbox tags are added to the tags set.
Usage
Used by weapons to perform trace attacks via the BaseCarryable.TraceAttack RPC:
CSHARP
TraceAttack( TraceAttackInfo.From( tr, config.Damage ) );The RPC handles damage application to IDamageable components and physics impulse on Rigidbody components on the host.
Location
File: d:\GitHubStuff\sandbox\code\Game\Weapon\BaseCarryable\BaseCarryable.cs
Was this helpful?