CollisionData

From GMod Wiki

Jump to: navigation, search
Warning 64.pngThis page needs to be edited as it contains information that is unclear or incorrect. Improvement can be discussed on the talk page. Find more pages that need work here.
Details: None given.
Structure
Name CollisionData
Available On: NewerServer.png
Description:
This structure is used by the ENT.PhysicsCollide hook. It contains data about a collision with something.

Members

Type Name Description
Vector HitPos This appears to be the position this entity was at when it collided with HitEntity.
Entity HitEntity The hit entity is what the scripted entity collided with. In addition to props, vehicles, etc., HitEntity is often a part of the level. You can check whether or not the Hit Entity is part of the level or not with the IsWorld() function.
Vector OurOldVelocity Before colliding with HitEntity, OurOldVelocity was this entity's velocity.
Physobj HitObject This is a specific physics object on HitEntity that we collided with. This is important because some entities have multiple physics objects, such as ragdolls.
Float DeltaTime How long (in seconds) it has been since this entity last collided with something. PhysicsCollide can easily be called 50 or 60 times a second, and Delta Time can be used to control how often something (such as impact sounds) happen.
Vector TheirOldVelocity This was the velocity of HitEntity before it collided with this entity.
Float Speed Speed is a positive number describing how "fast" (or perhaps more accurately, how hard) the two entities collided (this also applies to when this entity is frozen and HitEntity is moving instead).
Vector HitNormal This is a normalized vector; you can think of this as being the "facing direction" of the surface this entity hit on HitEntity.

Example

DescriptionN/A
Used onNewerMissing.png
Code
LuaIco3.pngThis page needs an example to demonstrate the item detailed on this page. See how to make one here.
See more articles that need examples here.
OutputN/A
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox