Skip to content

Mesh Files

Kakrain edited this page Jul 21, 2026 · 1 revision

Mesh Files

On this page, we will cover a specific type of filename field: mesh files.

Mesh files contain the geometry of a 3D object.

In FCS, mesh paths are stored as relative paths. To obtain the absolute path, KenshiPatcher provides the GetRealPath() function.

For example:

GetRealPath(GetField("mesh"))

Before accessing a mesh file, it is recommended to verify that it exists:

FileExists(GetRealPath(GetField("mesh")))

KenshiPatcher provides several functions for working with mesh files.

GetSkeletonLink

GetSkeletonLink(fullPath)

Returns the skeleton associated with the specified mesh.

Intersects

Intersects(string fullPath,float[3] p1,float[3] p2,optional bool fast = false) : bool

Checks whether the axis-aligned box defined by the opposite corners p1 and p2 intersects the specified mesh.

If fast is true, the function only checks whether any mesh vertex lies inside the box.

If fast is false, it also checks whether the mesh edges intersect the box, producing more accurate results.

GetIntersectionRatio

GetIntersectionRatio(string fullPath,float[3] p1,float[3] p2,optional int samples = 8) : float

Returns a value between 0 and 1 indicating how much of the box intersects the mesh.

  • 0 means there is no intersection.
  • 1 means the sampled volume of the box is completely occupied by the mesh.

To use the last two functions effectively, it is helpful to inspect the mesh in Blender:

Open Mesh File in Blender

The points p1 and p2 represent two opposite corners of the box.

Clone this wiki locally