Class ModelSockets
Named attach points exported in a glTF/GLB. Raylib's LoadModel drops
empties, so this reads the JSON chunk directly.
public sealed class ModelSockets
- Inheritance
-
ModelSockets
- Inherited Members
Remarks
Always author empties, joints, or connection nodes named
socket.<id> in the same space as the mesh (Y-up metres after
bake-prop). Spawn and attach from these points at runtime — particle
emitters, held weapons, attachments on weapons. Do not embed those
systems or extra meshes in the glb, and do not guess a world offset in
game code.
Fields
Prefix
public const string Prefix = "socket."
Field Value
Properties
All
public IReadOnlyDictionary<string, Vector3> All { get; }
Property Value
Count
public int Count { get; }
Property Value
Empty
public static ModelSockets Empty { get; }
Property Value
Methods
Load(IVirtualFileSystem?, string)
Packed or loose, through CECAL. Miss → Empty.
public static ModelSockets Load(IVirtualFileSystem? vfs, string logicalPath)
Parameters
vfsIVirtualFileSystemlogicalPathstring
Returns
Load(string)
Loose file. Games with packed assets should use the VFS overload.
public static ModelSockets Load(string path)
Parameters
pathstring
Returns
Parse(ReadOnlySpan<byte>)
public static ModelSockets Parse(ReadOnlySpan<byte> glb)
Parameters
glbReadOnlySpan<byte>
Returns
ToWorld(Vector3, Vector3, float)
Model-space point to world, matching raylib DrawModelEx
(rotate about +Y, then translate). Pass the same yaw you draw with.
public static Vector3 ToWorld(Vector3 local, Vector3 modelPosition, float yawDegrees)
Parameters
Returns
Remarks
Measured DrawModelEx yaw: x' = x cos θ + z sin θ,
z' = −x sin θ + z cos θ.
CreateRotationY(float) is the opposite sign — do
not use it here.
TryGet(string, out Vector3)
public bool TryGet(string name, out Vector3 local)
Parameters
Returns
World(string, Vector3, float)
public Vector3 World(string name, Vector3 modelPosition, float yawDegrees)