Table of Contents

Class ModelSockets

Namespace
PopcorningGuineaPig.Engine.Rendering
Assembly
PopcorningGuineaPig.Engine.dll

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

string

Properties

All

public IReadOnlyDictionary<string, Vector3> All { get; }

Property Value

IReadOnlyDictionary<string, Vector3>

Count

public int Count { get; }

Property Value

int

Empty

public static ModelSockets Empty { get; }

Property Value

ModelSockets

Methods

Load(IVirtualFileSystem?, string)

Packed or loose, through CECAL. Miss → Empty.

public static ModelSockets Load(IVirtualFileSystem? vfs, string logicalPath)

Parameters

vfs IVirtualFileSystem
logicalPath string

Returns

ModelSockets

Load(string)

Loose file. Games with packed assets should use the VFS overload.

public static ModelSockets Load(string path)

Parameters

path string

Returns

ModelSockets

Parse(ReadOnlySpan<byte>)

public static ModelSockets Parse(ReadOnlySpan<byte> glb)

Parameters

glb ReadOnlySpan<byte>

Returns

ModelSockets

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

local Vector3
modelPosition Vector3
yawDegrees float

Returns

Vector3

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

name string
local Vector3

Returns

bool

World(string, Vector3, float)

public Vector3 World(string name, Vector3 modelPosition, float yawDegrees)

Parameters

name string
modelPosition Vector3
yawDegrees float

Returns

Vector3