I’m trying to create gravity that doesn’t go in the negative Y axis (in this specific case, it’d be the positive Z axis instead), however, a single LinearVelocity (or one paired with a VectorForce) would not work, as the character being affected isn’t a (relatively) rigid object, but instead a ragdoll.
Currently, I give each of its limbs a VF and a LV, which somewhat simulates gravity correctly, but when I throw the ragdoll on some stairs, it fails to fall “down” the stairs as smoothly as it would if I was using roblox’s inbuilt gravity.
(“Falling” up the stairs using my artificial gravity)
(Falling down the stairs using default roblox gravity)
Code which applies the gravity:
for _, v in character:GetChildren() do
if v:IsA("BasePart") then
--if v.CanCollide == true then
local LV = Instance.new("LinearVelocity")
local VF = Instance.new("VectorForce")
local attach = Instance.new("Attachment")
VF.Parent = v
attach.Parent = v
LV.Parent = v
VF.Attachment0 = attach
LV.Attachment0 = attach
VF.RelativeTo = Enum.ActuatorRelativeTo.World
LV.RelativeTo = Enum.ActuatorRelativeTo.World
LV.ForceLimitMode = Enum.ForceLimitMode.PerAxis
LV.MaxAxesForce = Vector3.new(0, 10000, 0)
LV.VectorVelocity = Vector3.new(0, 0, 0)
VF.Force = Vector3.new(0, 0, 5*196.2 * v:GetMass())
--else
--v.Massless = true
-- continue
--end
end
end
(if it helps, the humanoid of the character is in the Physics state when it is ragdolled, and the server is the network owner of the character)