Garry's Mod Wiki

CollisionData

Description

Passed as argument of ENTITY:PhysicsCollide, EFFECT:PhysicsCollide and used with Entity:AddCallback.

Sometimes, the value of Speed can be different from getting the length calculated from OurOldVelocity, even though they should be the same, or close to same. It's recommended to do OurOldVelocity:Length() instead.

function ENT:PhysicsCollide( colData, collider ) -- you may get two completely different values, and the second one should be more accurate. print(colData.Speed) print(colData.OurOldVelocity:Length()) end

Parameters

Vector HitPos
The collision position
Entity HitEntity
The other collision entity
Vector OurOldVelocity
The entity's velocity before the collision
PhysObj HitObject
Other entity's physics object
number DeltaTime
Time since the last collision with the HitEntity
Vector TheirOldVelocity
Speed of the other entity before the collision
number Speed
The speed of the entity before the collision
Vector HitNormal
Normal of the surface that hit the other entity
PhysObj PhysObject
Entity's physics object
number OurSurfaceProps
Surface Property ID of this entity
number TheirSurfaceProps
Surface Property ID of the entity we collided with
Vector HitSpeed
The speed at which the impact happened
Vector OurNewVelocity
Our new velocity after the impact
Vector TheirNewVelocity
The new velocity after the impact of the entity we collided with
Vector OurOldAngularVelocity
Old angular velocity of this entity
Vector TheirOldAngularVelocity
Old angular velocity of the entity we collided with