Revision Difference
Structures/CollisionData#526355
<cat>struct</cat>
<structure>
<description>
Passed as argument of <page>ENTITY:PhysicsCollide</page>.
Passed as argument of <page>ENTITY:PhysicsCollide</page>, <page>EFFECT:PhysicsCollide</page> and used with <page>Entity:AddCallback</page>.
<note>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.
```
ENT:PhysicsCollide( colData, collider )
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
```
</note>
</description>
<fields>
<item name="HitPos" type="Vector">The collision position</item>
<item name="HitEntity" type="Entity">The other collision entity</item>
<item name="OurOldVelocity" type="Vector">The entity's velocity before the collision</item>
<item name="HitObject" type="PhysObj">Other entity's physics object</item>
<item name="DeltaTime" type="number">Time since the last collision `with this HitEntity`</item>
<item name="TheirOldVelocity" type="Vector">Speed of the other entity before the collision</item>
<item name="Speed" type="number">The speed of the entity before the collision</item>
<item name="HitNormal" type="Vector">Normal of the surface that hit the other entity</item>
<item name="PhysObject" type="PhysObj">Entity's physics object</item>
</fields>
</structure>