Garry's Mod Wiki

Revision Difference

Structures/CollisionData#517065

<cat>struct</cat> <structure> <description> Passed as argument of <page>ENTITY:PhysicsCollide</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 ) -- 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>{{StructureField|Vector|HitPos|The collision position</fields>⤶ <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> {{StructureField|Entity|HitEntity|The other collision entity}}{{StructureField|Vector|OurOldVelocity|The entity's velocity before the collision}}{{StructureField|PhysObj|HitObject|Other entity's physics object}}{{StructureField|number|DeltaTime|Time since the last collision `with this HitEntity`}}{{StructureField|Vector|TheirOldVelocity|Speed of the other entity before the collision}}{{StructureField|number|Speed|The speed of the entity before the collision}}{{StructureField|Vector|HitNormal|Normal of the surface that hit the other entity}}{{StructureField|PhysObj|PhysObject|Entity's physics object}}⤶ }}