Documentation
¶
Overview ¶
Package physics reads the collision shapes of a Source 2 model's PHYS block, a map's world_physics model included, as triangles in model space with the collision attribute that says what each shape blocks.
A model's physics is a list of parts, each with spheres, capsules, convex hulls and triangle meshes. A compiled map packs most of its world into compound shapes, each a bundle of hulls, meshes and capsules under one attribute. Shapes streams them all, one shape at a time, so a map's tens of thousands of hulls never sit in memory at once.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
Attribute is a collision attribute: the collision group a shape belongs to and the interaction layers it is, collides with, and ignores, as the game names them, such as "solid", "blocklos" or "Citadel_Bullet".
type Physics ¶
type Physics struct {
// contains filtered or unexported fields
}
Physics is a decoded PHYS block.
func (*Physics) Attributes ¶
Attributes returns the collision attributes shapes refer to.
type Shape ¶
Shape is one collision shape as triangles: its points, placed by its part's bind pose, and triangles as three indices into Points. Attribute indexes Physics.Attributes, or is -1 when the shape names none. Solid is true for a closed convex volume, a sphere, capsule or hull, and false for a triangle mesh, which may be open, such as terrain.