Skip to content

Item class

On Vket Cloud, each non-Player objects on the world are defined as Items.

Items can be output to the scene by placing and configuring game objects with components added by VketCloudSDK, such as VKC Item Field and VKC Item Object.

The Item class is used to manipulate the above-mentioned Item in HeliScript.

You can retrieve an instance of the Item class by calling functions such as hsItemGet().

Item class has various methods to operate the obtained Item object.

How to get Item class object from component

The Item class object held by the component is obtainable by making the following call from the method in the component.

Item myItem = hsItemGet("Item name");

Calling hsItemGetSelf() will obtain the Item instance of the script's current component.

Item myitem = hsItemGetSelf();

Item utility functions

hsItemGet

Item hsItemGet(string itemName)

Global Function. Gets an Item by the specified name.

hsItemGetSelf

Item hsItemGetSelf()

Global function. Gets the Item object of where this component itself is attached, by calling this function in the component's constructor, or methods such as Update, OnClickNode, etc.


Methods

Equals

public bool Equals(Item obj)

Judges whether this class is identical to the argument obj.

When obtaining Item objects using hsItemGet(), etc., a different instance may be obtained despite being the same Item. For checking identity, use Equals() instead of "===" operator.

Available object types for this method

GetName

public string GetName()

Get the name of the Item.

Available object types for this method

SetPos

public void SetPos(Vector3 pos)

Move Item to the designated position.

Available object types for this method

GetPos

public Vector3 GetPos()

Get the local position of Item.

If this Item is inside a VKC Item Activity, the obtained value will be the coordinates relative to the VKC Item Activity.

Available object types for this method

GetWorldPos

public Vector3 GetWorldPos()

Get the world position of Item.

Regardless of where this Item is located (inside or outside of a VKC Item Activity), it always returns the coordinates in world space.

Warning

Use this method when you want to obtain world coordinates in the case of an Activity.

If it is not an Activity, use GetPos for most of the time.

Available object types for this method

SetQuaternion

public bool SetQuaternion(Quaternion Rotate)

Set the quaternion rotation of Item.

Available object types for this method

GetQuaternion

public Quaternion GetQuaternion()

Get the local rotation of Item by quaternion.

Available object types for this method

GetWorldQuaternion

public Quaternion GetWorldQuaternion()

Get the world rotation of Item by quaternion.

Available object types for this method

GetWorldRotate

public Vector3 GetWorldRotate()

Get the world rotation of Item by Vector3 (Euler angles).

Available object types for this method

GetScale

public Vector3 GetScale()

Get the scale of Item by Vector3.

Available object types for this method

SetScale

public void SetScale(Vector3 Scale)

Set the scale of Item by Vector3.

Available object types for this method

MovePos

public void MovePos(Vector3 pos, float time, bool CollisionDetection = false)

Moves the Item over [time] seconds to the coordinates specified by pos.

If CollisionDetection is set to true, collision detection will be enabled as like the player avatar.

Available object types for this method

IsMoving

public bool IsMoving()

Returns true if the Item is moving.

Available object types for this method

Play

public bool Play()

Start playing a sound or particle. Returns true if the playback process has started successfully.
Returns false on failure.

Available object types for this method

Stop

public void Stop()

Stop the sound or particle that is playing.

Available object types for this method

IsPlay

public bool IsPlay()

Returns true if the sound or particle is playing.

Available object types for this method
Different return values for IsPlay
  • VKC Item Audio: Returns true if the designated audio clip is playing
  • VKC Item Object: Returns true if designated hem in Motion list is playing, when object mode is Motion
  • VKC Item Particle: Returns true if designated .hep particle is playing

Pause

public bool Pause()

Pauses the object's playing motion.

Available object types for this method

Restart

public bool Restart()

Resumes the object's playing motion after pause.

Available object types for this method

SetPlayTime

public bool SetPlayTime(float PlayTimeMS)

Sets the object's motion playing position by designated time.
The time is designated by millisecond.

Available object types for this method

GetPlayTime

public float GetPlayTime()

Gets the object's motion playing position by designated time.
The time is designated by millisecond.

Available object types for this method

SetShow

public void SetShow(bool flag)

Display Item with true. Hide the Item with false.

Available object types for this method

IsShow

public bool IsShow()

Returns true if the Item is visible, false otherwise.

Available object types for this method

ChangeMotion

public bool ChangeMotion(string MotionName, float BlendTimeMS = 0.0f)

Change the motion according to the designated MotionName.
BlendTimeMS will designate the time to blend the motion by milliseconds.

Available object types for this method

LoadMotion

public bool LoadMotion(string MotionName, string FileName, bool Loop)

Loads the designated motion.

Available object types for this method

FacialEmoteFixed

public bool FacialEmoteFixed(int FacialEmoteType)

Changes facial expression. Change will be done immediately, and will not return automatically as like the player avatar.

The facial types below can be designated:

  • FACIALEMOTETYPE_NEUTRAL
  • FACIALEMOTETYPE_JOY
  • FACIALEMOTETYPE_ANGRY
  • FACIALEMOTETYPE_SORROW
  • FACIALEMOTETYPE_FUN
Available object types for this method

Load

public bool Load()

Start loading the Item. Returns false if the loading process fails to start.

Available object types for this method

Unload

public bool Unload()

Unload the Item. Returns false if the unloading process fails.

Available object types for this method

IsLoading

public bool IsLoading()

Returns true if the Item is loading, false otherwise.

Available object types for this method

IsLoaded

public bool IsLoaded()

Returns true if the Item has finished loading, false otherwise.

Available object types for this method

GetNodeIndexByName

public int GetNodeIndexByName(string nodeName)

Finds a node by name and returns an index identifying that node. If the node is not found, -1 will be returned.

Available object types for this method

GetNodeNameByIndex

public string GetNodeNameByIndex(int nodeIndex)

Given a node by index, return the name of that node. If the node is not found, an empty string will be returned.

Available object types for this method

GetNodePosByIndex

public Vector3 GetNodePosByIndex(int nodeIndex)

Specify a node by index and return the coordinates of that node. If the node is not found, Vector3.zero will be returned.

Available object types for this method

SetShowNode

public bool SetShowNode(string nodeName, bool flag)

Specify a node by name, show it if flag is true and hide it if flag is false.

Available object types for this method

IsShowNode

public bool IsShowNode(string nodeName)

Specify a node by name, returns true if the node is visible and false if it is hidden.

Available object types for this method

SetRotateNode

public bool SetRotateNode(string nodeName, Vector3 rotate)

Specify a node by name and rotate that node.

Available object types for this method

SetEnableCollider

public bool SetEnableCollider(string nodeName, bool flag)

Specify a collider by name, true to enable it, false to disable it.

Available object types for this method

IsEnableCollider

public bool IsEnableCollider(string nodeName)

Specify a collider by name, returns true if the collider is enabled, false otherwise.

Available object types for this method

SetClickableNode

public bool SetClickableNode(string nodeName, bool flag)

Specify a clickable node by name, enable clicks if flag is set to true and disable clicks if flag is set to false.

Available object types for this method

IsClickableNode

public bool IsClickableNode(string nodeName)

Specify a node by name and returns true if the node is clickable, false otherwise.

Available object types for this method

SetUVOffset

public bool SetUVOffset(string materialName, float u, float v)

Specify a material by name and change the uv offset of that material starting from the top-left origin. Returns false if the change fails.

Origin coordinate of UV

While Unity considers the bottom-left coordinate of the UV as the origin, note that HeliScript considers the top-left as the origin.

Available object types for this method

PlayVideo

public void PlayVideo(string materialName, string url, bool loop)

Specifies the material to play and starts playing the video. Loop playback is performed if loop is set to true.

Available object types for this method

StopVideo

public void StopVideo()

Stop the video that is playing.

Available object types for this method

IsPlayVideo

public bool IsPlayVideo()

Returns true if a video is playing.

Available object types for this method

ClearTextPlane

public void ClearTextPlane()

Delete the text.

Available object types for this method

WriteTextPlane

public void WriteTextPlane(string text)

Set the text.

Available object types for this method

SetCamera

public bool SetCamera()

Set the camera type Item as a camera.
Refer to VKC Item Camera for usage.

Available object types for this method

ResetCamera

public void ResetCamera()

Detach camera set by SetCamera.
Refer to VKC Item Camera for usage.

Available object types for this method

ReplaceItem

public bool ReplaceItem(string URL)

Replace the Item by the designated model data.

Available object types for this method

ReplaceTexture

public bool ReplaceTexture(string MaterialName, string URL)

Replace the texture attached to the MaterialName's material by the designated URL content.

Available object types for this method

SetPhysicsEnable

public bool SetPhysicsEnable(string NodeName, bool Flag)

Enable physics for Node designated by NodeName if Flag is true, disable if Flag is false.

Available object types for this method

IsPhysicsFixed

public bool IsPhysicsFixed(string NodeName)

When physics is enabled, returns true if this Item is fixed.

Available object types for this method

GetPhysicsIDByNodeName

public int GetPhysicsIDByNodeName(string NodeName)

Get the PhysicsId for the designated Node.

When physics is enabled, returns true if this Item is fixed.

Available object types for this method

SetProperty

public bool SetProperty(string Key, string Value)

Set property by Key and Value.

Available object types for this method

GetProperty

public string GetProperty(string Key)

Get property by Key. If the Key does not exist, an empty string will return.

Available object types for this method

CallComponentMethod

public void CallComponentMethod(string ComponentName, string MethodName, string Params)

Calls the component method set to the item.
The method can be called by designating the Componentname and MethodName. the Params will be used as arguments.

The callable methods must follow the limits below:

  • Has one and only String type as an argument
  • Return value is void
Available object types for this method

SetOverridesProperty

public bool SetOverridesProperty(string Key, string Value, string ItemName)

Sets overrides property. If the same Key exists, its value will be overwritten, otherwise the Key and Value will be appended. If Key does not use "itemname", enter an empty string as an argument.

Available object types for this method

GetOverridesProperty

public bool GetOverridesProperty(string Key, ref string Value, ref string ItemName)

Get the overrides property.

Available object types for this method