Hello again DevForum. The end of the year is arriving, and my project’s main issue at the moment is the bird spawning.
The birds (models with Humanoid and HRP inside them) decide to spawn rotated around the spawn part sometimes, this seems to be random, although it happens more frequently if it has happened before.
I believe this may also be the cause of an acceleration effect which causes the bird model to roll like a snowball due to hitting something in the spawn part’s rotation sphere - in the pictures below it would be hitting the pole that the bird normally sits on.
Expected Result:
Display of bug:
Snippet of code that spawns birds:
Notes; The birds have a VectorForce and are being unachored as they spawn. I am setting the bird’s CFrame with a part inside the bird that has welds to all other parts.
--Determine the spawn location of the bird
local spawnCFrame = spawnPart.CFrame
--Clone the bird model
local modelToSpawn = modelToClone:Clone()
mainPart = modelToSpawn:WaitForChild("ModelOfBird"):WaitForChild("HumanoidRootPart")
--Give the bird a movement force
forceAttatchment = Instance.new("Attachment")
forceAttatchment.Name = "forceAttatchment"
forceAttatchment.Parent = mainPart
local totalMass = 0
for index,descendant in pairs(modelToSpawn:GetDescendants()) do
if descendant:IsA("BasePart") then
totalMass += descendant:GetMass()
end
end
local antiGravityVectorForce = Instance.new("VectorForce")
antiGravityVectorForce.Name = "antiGravityForce"
antiGravityVectorForce.Force = Vector3.new(0,totalMass * workspace.Gravity,0)
antiGravityVectorForce.ApplyAtCenterOfMass = true
antiGravityVectorForce.RelativeTo = Enum.ActuatorRelativeTo.World
antiGravityVectorForce.Attachment0 = forceAttatchment
antiGravityVectorForce.Parent = mainPart
--Spawn the bird
mainPart.Anchored = false
modelToSpawn.Parent = spawnPart
mainPart.CFrame = spawnCFrame
table.insert(spawnedBirdsInLoop,modelToSpawn)