SceneEdit¶
SceneEdit
APIs manages all objects in scenes via your assembler scripts.Functions¶
number createEmpty()¶
Creates an empty YahahaObject and returns the YahahaObject ID
void rename(number YahahaObjectID, string newName)¶
Renames a YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject to be renamednewName
The new name for the YahahaObject
void group(table YahahaObjectsID , boolean value)¶
Groups or ungroups YahahaObjects
YahahaObjectsID
The unique identifier of the YahahaObjects to be grouped. Once you have created a YahahaObject, its ID becomes visible, and you can access it through the object picker or by manually selecting it.value
If true, groups the YahahaObjects; if false, ungroups the YahahaObjects
void setPosition(number YahahaObjectID, float3 position)¶
Sets the position of the YahahaObject in world space
YahahaObjectID
The unique identifier of the YahahaObject whose position is to be set in world spaceposition
The position of the YahahaObject to be set in world space
float3 getPosition(number YahahaObjectID)¶
Returns the position of the YahahaObject in world space
YahahaObjectID
The unique identifier of the YahahaObject whose position is to be queried
void setLocalPosition(number YahahaObjectID , float3 position)¶
Sets the position of the YahahaObject in local space
YahahaObjectID
The unique identifier of the YahahaObject whose position is to be set in local spaceposition
The position of the YahahaObject to be set in local space
float3 getLocalPosition(number YahahaObjectID)¶
Returns the position of the YahahaObject in local space
YahahaObjectID
The unique identifier of the YahahaObject whose position in local space is to be queried
float3 getEulerAngles(number YahahaObjectID)¶
Returns the rotation of the YahahaObject as Euler angles in degrees
YahahaObjectID
The unique identifier of the YahahaObject whose rotation in world space is to be queried as Euler angles in degrees
void setEulerAngles(number YahahaObjectID, float3 rotation)¶
Sets the rotation of the YahahaObject as Euler angles in degrees
YahahaObjectID
The unique identifier of the YahahaObject whose rotation is to be set in world spacerotation
The rotation of the YahahaObject to be set in world space as Euler angles in degrees
float3 getLocalEulerAngles(number YahahaObjectID)¶
Returns the rotation of the YahahaObject in local space as Euler angles in degrees. The rotation value is calculated based on the previous frame.
YahahaObjectID
The unique identifier of the YahahaObject whose rotation in local space is to be queried
void setLocalEulerAngles(number YahahaObjectID, float3 rotation)¶
Sets the rotation of the YahahaObject in local space as Euler angles in degrees. The rotation value is calculated based on the previous frame.
YahahaObjectID
The unique identifier of the YahahaObject whose rotation in local space is to be setrotation
The rotation of the YahahaObject to be set in local space
float3 getScale(number YahahaObjectID)¶
Returns the scale of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject whose scale is to be queried
void setScale(number YahahaObjectID, float3 scale)¶
Sets the scale of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject whose scale is to be setscale
The scale of the YahahaObject to be set
number getDefaultPoint()¶
Returns the YahahaObject ID of the default respawn point
void delete(number YahahaObjectID)¶
Deletes the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject to be deleted
void setLock(number YahahaObjectID, boolean value)¶
Locks or unlocks the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject to be lockedvalue
If true, locks the YahahaObject; if false, unlocks the YahahaObject
void setActive(number YahahaObjectID, boolean value)¶
Activates or deactivates the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject to be activatedvalue
If true, activates the YahahaObject; if false, deactivates the YahahaObject
number duplicate(number YahahaObjectID)¶
Duplicates the YahahaObject and returns the unique identifier of the new YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject to be duplicated
void addCollider(number YahahaObjectID, ColliderType type)¶
Adds a specific type of collider to the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a collider is attached totype
A specific type of collider to be attached
void enableCollider(number YahahaObjectID, ColliderType type, boolean value)¶
Enables or disables the collider attached to the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a collider is attached totype
A specific type of collider attached to the YahahaObjectvalue
If true, enables the collider attached to the YahahaObject; if false, disables it
void addTrigger(number YahahaObjectID, ColliderType triggerType)¶
Adds a specific type of trigger to the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a trigger is attached totriggerType
A specific type of trigger to be attached to the YahahaObject. It can be Sphere, Box, or Capsule.
boolean hasCollider(number YahahaObjectID, ColliderType type)¶
Returns true if a specific type of collider is attached to the YahahaObject, or false if not
YahahaObjectID
The unique identifier of the YahahaObject that a collider is attached totype
A specific type of collider attached to the YahahaObject
boolean hasTrigger(number YahahaObjectID, ColliderType triggerType)¶
Returns true if a trigger is attached to the YahahaObject, or false if not
YahahaObjectID
The unique identifier of the YahahaObject that a trigger is attached totriggerType
A specific type of trigger attached to the YahahaObject. It can be Sphere, Box, or Capsule.
table getSelectedYahahaObjects()¶
Returns the unique identifier of the selected YahahaObjects
void selectYahahaObjects(table YahahaObject)¶
Selects YahahaObjects using their ID
YahahaObject
The unique identifier of the YahahaObjects to be selected
void setTrigger(<number YahahaObject(self), number YahahaObject(target), ColliderType triggerType, number Condition)¶
Sets the trigger. Configured with the TriggerPicker.
YahahaObject(self)
The YahahaObject that the trigger is attached toYahahaObject(target)
The target YahahaObject to be triggeredtriggerType
The trigger type. It can be Sphere, Box, or Capsule.Condition
The trigger condition
void setParent(number YahahaObject(child), number YahahaObject(parent))¶
Sets a parent YahahaObject for a child YahahaObject
YahahaObject(Child)
The YahahaObject as a childYahahaObject(parent)
The YahahaObject as a parent
number getAnimation(number YahahaObjectID, string name)¶
Returns the animation clip of the YahahaObject with the given name
YahahaObjectID
The unique identifier of the YahahaObject that the animation clip is attached toname
The name of the animation clip
float3 getBoundingCenter(number YahahaObjectID)¶
Returns the bounding box center of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that has a bounding box
float3 getBoundingSize(number YahahaObjectID)¶
Returns the bounding box size of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that has a bounding box
void setColliderCenter(number YahahaObjectID, float3 center, ColliderType type)¶
Sets the collider center of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a collider is to be attached tocenter
The center of the YahahaObject's collidertype
A specific type of collider to be attached to the YahahaObject
float3 getColliderCenter(number YahahaObjectID, ColliderType type)¶
Returns the collider center of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a collider is attached totype
A specific type of collider that is attached to the YahahaObject
void setColliderSize(number YahahaObjectID, float3 size, ColliderType type)¶
Sets the collider size of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a collider is to be attached tosize
The size of the collider that is to be attached to the YahahaObjecttype
A specific type of collider to be attached to the YahahaObject
float3 getColliderSize(number YahahaObjectID)¶
Returns the collider size of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a collider is attached to
void setColliderRadius(number YahahaObjectID, number radius, ColliderType type)¶
Sets the collider radius of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a collider is to be attached toradius
The radius of the collider that is to be attached to the YahahaObjecttype
A specific type of collider that is attached to the YahahaObject
number getColliderRadius(number YahahaObjectID, ColliderType type)¶
Returns the collider radius of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a collider is attached totype
A specific type of collider that is attached to the YahahaObject
void setColliderHeight(number YahahaObjectID, number height)¶
Sets the capsule collider height of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a capsule collider is to be attached toheight
The height of the capsule collider that is to be attached to the YahahaObject
number getColliderHeight(number YahahaObjectID)¶
Returns the collider height of the YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject that a capsule collider is attached to
number createAsset(number AssetID)¶
Creates a YahahaObject with an asset ID and returns the new YahahaObject ID
AssetId
The unique identifier of the asset
number getAssetID(number YahahaObjectID)¶
Returns the asset ID of a YahahaObject
YahahaObjectID
The unique identifier of the YahahaObject
number createItemById(number itemId)¶
Creates an item using the asset ID and places the item into the scene
ItemId
The unique identifier of the item
void selectYahahaObjects(table YahahaObjectsID)¶
Selects YahahaObjects
YahahaObjectsID
The unique identifier of the YahahaObjects to be selected
void openInspector()¶
Opens the Properties window
Code samples¶
Here are some code samples using SceneEdit
APIs for editing a scene:
-- Load the built-in assembler module in the header code
require("assembler")
-- Execute the logic part of the script
function execute()
-- Set the asset ID for the assembler
local assetId = 274880352875
-- Create an empty YahahaObject and store its ID in the "parent" variable
local parent = createEmpty()
-- Create an asset in the scene using the asset ID
local asset = createAsset(assetId)
-- Rename the parent variable as "Cube"
rename(parent,"Cube")
-- Get the position offset between the asset and the parent object, and print it to the console's output
local pos = getLocalPosition(asset)
print(string.format("Cube position : { x = %d , y = %d , z = %d}",pos.x,pos.y,pos.z))
-- Set the parent object as a parent for the asset and reset the asset's local position to (0,0,0)
setParent(asset, parent)
setLocalPosition(asset,float3.New(0,0,0))
-- Set the asset's rotation to (45,45,45)
local value = float3.New(45,45,45)
setLocalEulerAngles(asset,value)
-- Set the asset's scale to (5,5,5)
setScale(asset,float3.New(5,5,5))
-- Add a box collider to the asset
addCollider(asset, ColliderType.Box)
-- Get the size of the box collider and print it to the console's output
local size = getColliderSize(asset)
print(string.format("BoxCollider Size : { x = %d , y = %d , z = %d}",size.x,size.y,size.z))
-- Duplicate the asset and name the new asset as "New Asset"
local new_asset = duplicate(asset)
rename(new_asset,"New Asset")
-- Select the new asset
selectEntities {new_asset}
-- Open the Properties window of the new asset
openInspector()
end