I’m creating an Inventory system, and I’m trying to give my items their own custom physics.
I’ve set up the items to be above any surface by 6 studs(can change in the future), and I’m trying to figure out a way I can use normals to create a sliding effect, whenever the objects are on slopes.
Here’s my current testing code:
game:GetService("RunService").Heartbeat:Connect(function()
local RayPart = script.Parent
local RayCastParams = RaycastParams.new()
RayCastParams.FilterType = Enum.RaycastFilterType.Blacklist
RayCastParams.FilterDescendantsInstances = {Norm, RayPart}
local RayCast = workspace:Raycast(RayPart.Position, RayPart.CFrame.UpVector * -1000, RayCastParams)
if RayCast then
RayPart.CFrame = CFrame.new(RayCast.Position + Vector3.new(0,6,0))
--print("e")
end
end)
In this image, I want the Item above, to slide down to the position of the blue item.