I posted what is likely the Final update to this Resource! I have added an executable object called “SwarmFocus” you simply place the object and poof appears a random swarm! I have included the model I used to generate Pixies using my AI character generator.
I also tested this an it navigates around obstacles!
It adds nice ambience to the game. It would be really easy to make a game catching butterflies with a net.
Or even JellyFish
Here’s some inspiration
I have updated the model with non animated Jellyfish to inspire.
In the future might modularize the code more to it core components in a seperate module and different implementations in a seperate descendant module.
Also improved the readability and modularity of the code in the published model and added Dove animation
Another update I fixed the orientation of the birds so they face the direction they are moving and added a thing that randomizes the size of the bird.
I fixed this bug where it was going through objects and stuff I accidentally had this variable set to 0 and meant to be the opposite
Okay finally have debugged the code to make it not throw positions inside terrain with this function I had laying around I used for a previous project.
local function detecter(material)
for i,v in material do
if material[i] then
if i~="Size" then
--if material[i][1] then
for t,o in material[i] do
for c,p in material[i][t] do
if material[i][t][c]~=Enum.Material.Water and material[i][t][c]~=Enum.Material.Air then
return true
end
end
end
end
end
end
return false
end
local terrain=workspace.Terrain
local function CheckTerrain(GoalPosition)
local GoalPosition=CFrame.new(GoalPosition)
local region = Region3.new(GoalPosition.Position-Vector3.new(2,2,2),GoalPosition.Position+Vector3.new(2,2,2))
local material = terrain:ReadVoxels(region, 4)
if detecter(material) ==true then
repeat
GoalPosition=GoalPosition:ToWorldSpace(CFrame.new(0,2,0))
local region = Region3.new(GoalPosition.Position-Vector3.new(2,2,2),GoalPosition.Position+Vector3.new(2,2,2))
material = terrain:ReadVoxels(region, 4)
until detecter(material) ==false
GoalPosition=GoalPosition:ToWorldSpace(CFrame.new(0,0,0))
end
return GoalPosition.Position
end```