local O=3.3 local c=vector.create(0,-1,0)*O local M=vector.create(0,O,0)local y=require("\064\115\104\097\114\101\100\047\102\114\097\109\101")local w=require("\064\115\104\097\114\101\100\047\119\111\114\108\100")local J=require("\064\115\104\097\114\101\100\047\099\111\109\112\111\110\101\110\116\115")local X=RaycastParams.new()X.FilterDescendantsInstances={workspace.characters}X.FilterType=Enum.RaycastFilterType.Exclude return y.on("\112\104\121\115\105\099\115",function()for O,y in(w:query(J.SimulatedRig)):iter()do local w=workspace:Blockcast(y.root.CFrame,y.root.Size,c,X)y.position.Enabled=w~=nil if w then y.position.Position=w.Position+M end end end)
local HIP_HEIGHT = 3.3
local DIRECTION = vector.create(0, -1, 0) * HIP_HEIGHT
local HIP_HEIGHT_VECTOR = vector.create(0, HIP_HEIGHT, 0)

local frame = require("@shared/frame")
local world = require("@shared/world")
local components = require("@shared/components")

local ray_params = RaycastParams.new()
ray_params.FilterDescendantsInstances = { workspace.characters }
ray_params.FilterType = Enum.RaycastFilterType.Exclude

return frame.on("physics", function()
	for _, LocalHumanoid in world:query(components.SimulatedRig):iter() do
		local hit_floor = workspace:Blockcast(LocalHumanoid.root.CFrame, LocalHumanoid.root.Size, DIRECTION, ray_params)

		LocalHumanoid.position.Enabled = hit_floor ~= nil

		if hit_floor then
			LocalHumanoid.position.Position = hit_floor.Position + HIP_HEIGHT_VECTOR
		end
	end
end)
