<model>
<model> draws a rotatable 3D model inside a component — the item in a shop
slot, the speaker’s head in a dialogue box, the character preview in an
equipment screen.
<model x="center" y="center" w="fill" h="fill" item={Items.RUNE_SCIMITAR} zoom={520} />Reference
Section titled “Reference”<model>
Section titled “<model>”<model> accepts all
common props, plus one of these
five, which say what to draw:
model: A model reference. The model to draw.item: An item reference. Draws that item’s model instead.npcHead: An NPC reference. Draws that NPC’s chathead, as a dialogue box does.objectHead: A world-object reference. Draws that object’s model.playerHead: A flag. Draws the local player’s own chathead.
and these, which say how:
itemCount: A number. The stack size, which for some items changes the model drawn.itemCountMode:"auto","never"or"always". As on<sprite>.anim: An animation reference. Plays that animation on the model.zoom: A number. Camera distance — larger is further away, so a larger number draws a smaller model.pitch: A number, 0–2047. Rotation about the X axis.yaw: A number, 0–2047. Rotation about the Y axis.roll: A number, 0–2047. Rotation about the Z axis.offsetX,offsetY: Numbers. Shift the model within the component, in screen space.orthogonal: A boolean. Draws without perspective.transparent: A boolean. Draws the model translucent.deferred: A boolean. Leave the definition’s value for this model’s state-reading props until the state first moves — see common props.
Caveats
Section titled “Caveats”model,item,npcHead,objectHeadandplayerHeadare alternatives. Set one.- Angles are 0–2047, not degrees. A quarter turn is 512.
- Only
zoomdecides how large the model appears. The component’s width and height place its centre, and the model is not clipped to them. zoom,pitch,yaw,roll,offsetXandoffsetYare written together: set one and the rest are 0, sozoomalone draws an item unrotated. Leave all six off anditemdraws in its inventory pose.- Through a ref, the pose is written as a group.
ref.pitch = nalone is refused (TS2E215). Writeref.props = { offsetX, offsetY, pitch, yaw, roll, zoom }— seeuseRef.
Showing an item
Section titled “Showing an item”<model x="center" y="center" w="fill" h="fill" item={Items.RUNE_SCIMITAR} zoom={520} />Showing a rotated model
Section titled “Showing a rotated model”<model x="center" y="center" w="fill" h="fill" item={Items.RUNE_SCIMITAR} zoom={560} yaw={256} pitch={256} />Showing a talking head
Section titled “Showing a talking head”<model x="center" y="center" w="fill" h="fill" npcHead={Npcs.WISE_OLD_MAN} anim={Animations.TALK} zoom={800} />Showing the player’s own head
Section titled “Showing the player’s own head”<model x="center" y="center" w="fill" h="fill" playerHead zoom={800} />It draws only for a logged-in player.
Troubleshooting
Section titled “Troubleshooting”My model is tiny, huge, or not visible
Section titled “My model is tiny, huge, or not visible”zoom is a distance, so raise it to shrink the model and lower it to grow it.
If nothing appears at all, the model may be off-centre — adjust offsetX and
offsetY, and check its parent is large enough.
My model faces the wrong way
Section titled “My model faces the wrong way”Angles run 0–2047 rather than 0–359. If you converted from degrees, multiply by about 5.69.
ref.yaw = n is refused
Section titled “ref.yaw = n is refused”The pose is one group. Write every part of it:
ref.props = { offsetX: 0, offsetY: 0, pitch, yaw, roll, zoom }.