Repository navigation
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(fullPath)Returns the skeleton associated with the specified mesh.
Intersects(string fullPath,float[3] p1,float[3] p2,optional bool fast = false) : boolChecks 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(string fullPath,float[3] p1,float[3] p2,optional int samples = 8) : floatReturns a value between 0 and 1 indicating how much of the box intersects the mesh.
-
0means there is no intersection. -
1means 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:
The points p1 and p2 represent two opposite corners of the box.
-
Getting Started
-
Cookbook
-
Patch Language
-
Variable Types
-
Miscellaneous
-
Support