I`m working on a more advanced method for making realistically behaving creatures that are animated by multiple aligned positions and when the creatures is put in a idle standing mode the back legs raise up for no reason and it does this nearly every time.
This is the part of the script that controls the standing state:
for i,e in pairs(script.Parent.Body.Limbs.Legs.Pair1:GetChildren() and script.Parent.Body.Limbs.Legs.Pair2:GetChildren()) do
for i,h in pairs(e.LimbHolder:GetChildren()) do
if h.Name == "Leg1" or h.Name == "Leg2" then
--local Part = h.Foot
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.FilterDescendantsInstances = {script.Parent}
local origin, direction = h.Foot.Position,h.Foot.Position - Vector3.new(0,100,0)
local raycastResult = workspace:Raycast(origin, direction, raycastParams)
if raycastResult ~= nil then
if (h.Foot.Position - raycastResult.Position).Magnitude < h.Foot.Size.X + 3 then
print("YEZZZ")
e.LimbHolder.PullUp.PullUp.Position = Vector3.new(e.LimbHolder.Position.X,h.Foot.Position.Y + h.Parent.Info.HoldUpVal.Value,e.LimbHolder.Position.Z)
h.Foot.FootPos.FootMove.Position = Vector3.new(h.Foot.Parent.PrimaryPart.Position.X,h.Foot.Position.Y,h.Foot.Parent.PrimaryPart.Position.Z) + Vector3.new(0,-2,0)
--if h.Foot.FootPos.FootMove.MaxForce == 0 then
h.Foot.FootPos.FootMove.MaxForce = 5000000
--end
e.LimbHolder.PullUp.PullUp.MaxForce = 5000000000
else
print("OFFF")
h.Foot.FootPos.FootMove.MaxForce = 0
e.LimbHolder.PullUp.PullUp.MaxForce = 0
end
else
print("OFFF")
h.Foot.FootPos.FootMove.MaxForce = 0
e.LimbHolder.PullUp.PullUp.MaxForce = 0
end
end
end
end