Cloner is a Spark AR tool for dynamically instantiating blocks and controlling them without coding.
You can do the following things in Patch Editor:
- Instantiate block
- Clear all instantiated blocks
- Control the position/ rotation/ scale of the instance by index
- Bridge instance's Inputs to Patch Editor with Inputs Map
- Download Cloner.js (Right click and Save as)
- Download Cloner.arblock
- Drag/Drop both of them to your Spark AR project.
- Add capability:
Project > Edit Properties > Capabilities > + > Scripting Dynamic Instantiation
- You can also Click Here to Download a Sample Project (v112).
Drag the Cloner Block to Scene and set inputs, these are basic settings:
Inputs | Type | Description |
---|---|---|
Instantiate | Pulse | Trigger this to create an instance. |
Clear | Pulse | Trigger this to clear all instance. |
Block Name | Text | The name of the block to be instantiated. |
Parent Name | Text | The name of the scene object that holds instance. |
The following settings are used to control instance's Transform:
Inputs | Type | Description |
---|---|---|
Control Index | Number | The index of instance to be controlled. The index is start from 0 .-1 means the last instantiated instance;-2 means all of instances. |
Position | Vector 3 | The position of controlled instance. |
Scale | Vector 3 | The scale of controlled instance. |
Rotation | Vector 3 | The rotation of controlled instance. |
You can control the Inputs of instance block with following advanced setting:
Inputs | Type | Description |
---|---|---|
Prefix | Text | The prefix of To Script varaible name. |
Inputs | Text | The map to bridge instance's Inputs to To Script. Learn more. |
The map pattern should look like this: Name:type,Name:type,Name:type.
e.g. Your block has four property:
- Floaing with type
Boolean
- Frequency with type
Number
- Color A with type
Color
- Color B with type
Color
If you want to control the Floaing, Frequency and Color B, the map is;
Floating:b,Frequency:n,Color B:c
And then you need to add the the following To Script variables:
-
Floaing with type
Boolean
-
Frequency with type
Number
-
Color_B with type
Vector4
After restart, you can set these variables in Patch Editor.
If this is useful for you, please consider a donation🙏🏼. One-time donations can be made with PayPal.