This translation is older than the original page and might be outdated. See what has changed.
Translations of this page:

Sidebar

en:vci:script:reference:exportavatar

Table of Contents

ExportAvatar

This acquires avatar information.

It can be acquired from GetOwner or GetAvatars on ExportStudio.

List of functions

For the latest list of the functions, refer to “types.lua” file in “EmbeddedScriptWorkspace” folder.

ExportAvatar

Function Description
GetName fun(): string
GetId fun(): string Get the user ID of a user. The value is only valid in the current studio. The ID will change after leaving the studio.
IsOwner fun(): bool Return whether the user is the owner of the VCI or not.
GetLocalPosition fun(): Vector3 Get the local coordinate of the feet. *1
GetPosition fun(): Vector3 Get the world coordinate of the feet. *1
GetLocalRotation fun(): Quaternion Get the local rotation.
*1
GetRotation fun(): Quaternion Get the world rotation. *1
GetLocalScale fun(): Vector3 Get the scale. *1
GetRight fun(): Vector3 Get the vector of right direction (+X). *1
GetUp fun(): Vector3 Get the vector of up direction (+Y). *1
GetForward fun(): Vector3 Get the vector of forward direction (+Z). *1
GetLocalToWorldMatrix fun(): Vector3 Get the matrix of when converting from the local coordinate to the world coordinate. *1
GetBoneTransform fun(boneName: string): usertype Get the bone information. *1

*1
You could receive nil while loading avatar information or when changing avatars. Make sure to check for nil when using it.


About the GetBoneTransform

GetBoneTransform is a function to get bone information by inputting HumanBodyBones variable. If you specify an invalid bone name or unsupported bone, you will receive null.

Use cases

main.lua
    -- Acquire owner information.
    local owner = vci.studio.GetOwner()
 
    ---- Acqure the SubItem
    local subItem = vci.assets.GetSubItem("SubItem1")
 
    -- Move the SubItem to the right hand position.
    local rightHand = owner.GetBoneTransform("RightHand")
    if rightHand then
        subItem.SetPosition(rightHand.position)
        subItem.SetRotation(rightHand.rotation)
    end

Bone information (Table type)

Key Type Description
position Vector3 The world coordinate of the bone
rotation Quaternion The world rotation of the bone
en/vci/script/reference/exportavatar.txt · Last modified: 2019/12/20 19:22 by h-eguchi

Page Tools