LENS STUDIO: BUTTERFLIES
An asset I made for Lens Studio that instantly adds butterflies to your scene.
If your device has Lidar, they can land on your environment and avoid collisions with it!
It works without any coding!
But in case you want to change parameters for the butterflies on runtime, you could use this:
– Spawn a number of butterflies (n is a whole number). This function is called on start if ‘spawnOnStart’ is more than 0.
– Remove all currently instanced butterflies
– Get or set the butterfly moving speed
– Get or set the ‘hyperactive’ character trait of the butterflies
– Get or set the random sizes of newly spawned butterflies (vec2 containing min, max)
– Get or set the strength at which butterflies follow the transform
– Get or set the radius around the followed transform to stay in (world space)
– Get or set the transform for butterflies to follow (uses position only, default is this Butterfly Controller’s Transform)
– Get or set whether butterflies should always be above ground level (world y = 0)
– Get or set whether butterflies should land on the world mesh occasionally (world mesh generation/lidar needed) – when ebabled, script.api.deviceTrackingComponent is required for it to work!
– Get or set whether butterflies should avoid collisions with the world mesh (slower, especially when there are a lot of butterflies flying around)
– Get or set the Device Tracking Component needed (necessary when landing on world mesh is enabled)
– Get or set the world mesh classifications that butterflies can land on (indices, from lensstudio.snapchat.com/api/classes/TrackedMeshFaceClassification)
– Get the array of currently instanced butterfly Scene Objects