Slots Documentation
Slot is a helper set by an artist that helps with alignment of an asset in various situations.
Types of slots:
- attachment slots - used when the asset is held by a player/NPC
- picking slots - used when player/NPC is reaching for an asset to put it in their inventory (it's more flexible than holding slot)
- placement slots - used when the asset is being displayed in the shop. Without it the asset can still be sold by merchants, but won't be visible in the world (just as an icon in the invetory).
- lock slots - used to align lockpicking animation
- sharpening slots - used to align sharpening animation
From technical standpoint, slots can be present in two places. As slots in static models or as bones on the skeleton for chars. At both those places they should behave the same.
Example:
1) These are two attachment slots defining how will the object align while being held by an NPC/player. One for right hand, the other for left.
2) These are picking slots defining possible places where an NPC/player can reach in order to pick the sword up.
3) These are three possible ways to place this sword on a shop counter. One of them is picked at random so even with multiple swords of the same type there should be some variation.
4. This is to what the sword aligns during sharpening minigame
Contents
How to create a slot
3ds Max
Slots are created in 3ds Max and linked under the render mesh on the same level as LODs and physics proxies. Theoretically you can use whatever object you want as a slot, but to keep things simple and manageable it's best to use Point Helper. With it you can quickly see the rotation of the slot with Axis Tripod on. In case you stumble upon a max file using dummy instead, please replace it with point.
In case of a character, the slot has to be linked to a bone you want it to move with. Usually this will be the root bone, but it can be an animated one as well.
Type of slot is defined by it's name, so name matters!
Transforms
- Position - This is simply an offset of the alignment.
- Rotation - different axis means different directions in various slots, so be sure to check how you should rotate the slot you're creating.
- Scale - should usually be at 100,100,100. Most operations will disregard scale anyway, but some take it into the account (like placement).
Be sure not to reset transform and scale or you'll lose what makes it usefull.
Debug
To visualise the slots in editor use:
1. e_debugDraw = 15 for static objects.
You will be able to see the names of the different slots as well as their axes.
2. ca_drawSkeleton = 1 for characters.
You won't see names of those slots, but you can filter the visible ones with ca_filterJoints = * to get only the ones you're interested in.
Testing slots
Ideal way to debug your slots is to try them in Character Tool.
Go to View->Open View Pane->Character Tool
In Assets panel look for Objects->characters->humans->skeleton->male.cdf and double-click it. Male NPC should load up.
You'll see available attachment bones on the right in Properties panel. Select the attachment bone you want to test (probably right hand, maybe left hand, hardly ever anything else) and expand it.
Click into the Geometry field or on the folder button next to it and a load dialog should appear. Browse for the object you're testing and hit ok. It should now be somewhere around the attachment bone.
Now you have to fill the name of the slot you want to test into the slot field. This will finaly position the object as it will be in the game.
But wait, unfortunatelly not all animations are standardized, so the rotation of the attachment bone might change. This is very sad, but so is life in general It means that ideally you want to try your slot with an animation it is inteded for. To select an animation go back to Assets panel and look for Animations->humans->male and than double-click the animation that your favourite animator pointed you to.
You can now see how the NPC uses the object. Congratulations!
Attachment slots
- slt_0 - is used to bind with right hand
- slt_1 - is used to bind with left hand
Picking slots
- pck_ir_0X
- i - inverse = z axis of this slot can be inversed
r - rotational = slot can be rotated aroun z axis - deprecated- x - none
Examples:
- pck_xx_00 – fixed slot
- pck_ix_01 – inverse slot
- pck_xr_02 – rotational slot
- pck_ir_03 – rotational and inverse slot
Pickable item can (and very often should) have multiple picking slots to provide best-looking picking animation from different approach angles.
Placement slots
There are several places where items are automatically placed in a predefined area (for example shops) in our game. For an object to be placed in such an area it needs a placement slot. An object can have multiple placements slots. One of those is then randomly picked and used during placement; this can add more variation to automatic placement.
Naming
In order to use this dummy for object placement its name have to contains "plc" substring. You can also include "rot" substring to let object randomly rotate according Z axis after placement transformation was applied. This gives us more natural look too. Example of proper naming:
- plc_01
- plc_rot_01
- placement_with_rotation_01
Transforms
Z axis points to the top of a placement area. Scale of the slot is used, so make sure it's 100, 100, 100 in 3ds Max.
Lock slots
- slt_lock
With lock slots there's a difference between doors and chests, because while chests are normally exported as CGA, the doors are always characters. Also the rotation of the slots is different.
Chests
In case of chests the slot is linked right to the rendermesh. You can see the proper rotation on the picture. Y goes outside the lock while Z points up. You can also make a cabinet, which has a lock at the same height as the doors. The offset of the slot from pivot of the chest (which has to be aligned to the front side at ground height) is:
- 35 cm up for chests
- 76 cm up for closets (doors)
Doors
Attach the lock slot to the skeleton as seen below in the picture. The slot is rotated with Y going outside the lock and Z pointing up.
Sharpening slots
- sharpening_center
Only swords and axes can by sharpened.
Sharpening slot position – offsetted from slt_0 by 45,795 cm for short swords and axes or 55,149 cm for long swords respectively. For slot axis orientation see image bellow (but orientation probably doesn't matter)