Skip to content

Posing

Posing. A plugin puts each character in the scene with its skeleton, and hands its bones and weights here each frame, which Wraith changes in place. Any thread.

Get it with Api.posing().

claim(changed: Wraith.Lease.Changed | null): Wraith.Lease
active(): boolean
pose(entity: import("salamander").Given<Wraith.Scene.Id>, matrices: number | bigint | Wraith.Mat4 | null): void
shapes(entity: import("salamander").Given<Wraith.Scene.Id>, weights: number | bigint): void
wanted(entity: import("salamander").Given<Wraith.Scene.Id>): boolean
place(entity: import("salamander").Given<Wraith.Scene.Id>, to_world: import("salamander").Given<Wraith.Mat4>): boolean
addSolver(info: import("salamander").Given<Wraith.Ik.Info>, solve: Wraith.Ik.Solve, options: Wraith.Ik.DrawOptions | null): void
removeSolver(id: string): void

A lease on posing the game’s characters, see Lease. Only the holder’s are posed.

Fails with LeaseError. Uses Lease.Changed, Lease.

It holds the lease and posing’s in use. When false the game can skip handing bones over.

Each frame per entity with a skeleton, after animation and physics, before anything follows it. matrices has one per bone, in the space its transform takes to the world’s, row vectors.

Uses Scene.Id, Mat4.

Each frame per entity with shapes, after pose. weights has one per shape, 0 to 1.

Uses Scene.Id.

Whether the player’s picked or posed it, so the game can animate it in full.

Uses Scene.Id.

Each frame per movable entity, before pose: to_world, where the game has it, becomes where the player’s moved it, which its bones are handed over relative to. True if it’s moved.

Uses Scene.Id, Mat4.

An IK solver chains can pick, till it’s removed or the plugin goes. The same id replaces it.

Fails with PosingError. Uses Ik.Info, Ik.Solve, Ik.DrawOptions.

What can go wrong, besides Cancelled, Unsupported and Gone.

Code Error
1 Unavailable Posing hasn’t started
2 InvalidId Not letters, digits, _, - and .
3 InvalidInfo Too few or many bones
4 Failed

Scaled, then turned, then moved

A struct, 0x28 bytes, aligned to 4.

Offset Field Type
0x0 position Vec3
0xc rotation Quat
0x1c scale Vec3
position: Wraith.Vec3
rotation: Wraith.Quat
scale: Wraith.Vec3

A struct, 0x38 bytes, aligned to 8.

Offset Field Type
0x0 name string
0x10 transform Posing.Transform
name: string
transform: Wraith.Posing.Transform

A struct, 0x28 bytes, aligned to 8.

Offset Field Type
0x0 mesh string Empty in an edit for every mesh’s shape of that name
0x10 name string
0x20 weight f32
mesh: string
name: string
weight: number

A .pose file, as JSON: a character as posed, and the edits that made it.

A struct, 0x78 bytes, aligned to 8.

Offset Field Type
0x0 version u32 Goes up when what’s in it changes
0x8 actor string
0x18 bones []Posing.BonePose Each bone relative to its parent, as posed
0x28 edits []Posing.BonePose Only the player’s changes, each in its bone’s own axes, on top of its animation. Till version 3
0x38 shapes []Posing.ShapePose Every shape’s weight, as posed
0x48 shape_edits []Posing.ShapePose Till version 3
0x58 ik []Posing.IkChain IK chains, from version 2
0x68 changes []Posing.Edit Every edit, of every kind, from version 3
version: number
actor: string
bones: Array<Wraith.Posing.BonePose>
edits: Array<Wraith.Posing.BonePose>
shapes: Array<Wraith.Posing.ShapePose>
shape_edits: Array<Wraith.Posing.ShapePose>
ik: Array<Wraith.Posing.IkChain>
changes: Array<Wraith.Posing.Edit>

An enum of u8.

Value Name
0 relative On top of the game’s, which still moves under it
1 absolute In place of the game’s

An enum of u8.

Value Name
0 transform
1 weight

A struct, 0x2c bytes, aligned to 4.

Offset Field Type
0x0 tag Posing.EditValueKind
0x4 payload Posing.EditValue.Members
tag: Wraith.Posing.EditValueKind | Wraith.Posing.EditValueKindName
payload: Wraith.Posing.EditValue.Members

One of the player’s edits, of any kind.

A struct, 0x60 bytes, aligned to 8.

Offset Field Type
0x0 table string Its kind, like bones, shapes or placement
0x10 scope string What it’s within, like a shape’s mesh, empty for every one
0x20 key string What it’s on, like a bone, empty for the character itself
0x30 mode Posing.EditMode
0x34 value Posing.EditValue
table: string
scope: string
key: string
mode: Wraith.Posing.EditMode | Wraith.Posing.EditModeName
value: Wraith.Posing.EditValue

An enum of u8.

Value Name
0 character Moves with the character
1 world

A chain of bones turned so its tip reaches a target, every frame after the edits.

A struct, 0x80 bytes, aligned to 8.

Offset Field Type
0x0 tip string The last bone, which reaches the target
0x10 bones u32 How many, the tip and those above it
0x18 solver string An Ik.Info id, like wraith.two_bone, or plugin.id for a plugin’s
0x28 target Posing.Transform In space. Its rotation only counts with match_rotation
0x50 space Posing.IkSpace
0x51 has_pole bool Where the bend points, in space, with has_pole
0x54 pole Vec3
0x60 weight f32 0 to 1
0x64 enabled bool
0x65 auto_bake bool Not solved each frame. Moving the target bakes it into the edits instead
0x66 match_rotation bool The tip turned to the target’s rotation too
0x68 iterations u32
0x6c tolerance f32
0x70 options string The solver’s own settings
tip: string
bones: number
solver: string
target: Wraith.Posing.Transform
space: Wraith.Posing.IkSpace | Wraith.Posing.IkSpaceName
has_pole: boolean
pole: Wraith.Vec3
weight: number
enabled: boolean
auto_bake: boolean
match_rotation: boolean
iterations: number
tolerance: number
options: string

A struct, 0x40 bytes, aligned to 8.

Offset Field Type
0x0 id string Letters, digits, _, - and .. Chains name it as plugin.id
0x10 title string
0x20 help string
0x30 min_bones u32 Bones in a chain it takes, the tip included. 0 for no most
0x34 max_bones u32
0x38 pole bool It bends toward Request.pole
id: string
title: string
help: string
min_bones: number
max_bones: number
pole: boolean

A struct, 0x58 bytes, aligned to 8.

Offset Field Type
0x0 chain []Mat4 Root first, tip last, each the one before’s child, in the character’s space, row vectors
0x10 bones []string Root first, tip last, each the one before’s child, in the character’s space, row vectors
0x20 target Vec3 Where the tip goes, in the character’s space
0x2c has_pole bool
0x30 pole Vec3
0x3c iterations u32
0x40 tolerance f32
0x48 options string The chain’s own settings, as DrawOptions left them
chain: Array<Wraith.Mat4>
bones: Array<string>
target: Wraith.Vec3
has_pole: boolean
pole: Wraith.Vec3
iterations: number
tolerance: number
options: string

Any thread, each chain each frame. The chain solved, root first, or empty to leave it, read before the next call. Don’t call Posing from inside it.

Wraith.Ik.Solve

Render thread, under Wraith’s settings for a chain: its own, returning options as changed.

Wraith.Ik.DrawOptions

Made with ♥ by Asgard