How to create the super mario like jumping through platforms effect?

Hey guys,
I want to create this super mario like effect, where you can jump through parts when you stand under them and then after you jumped through them you can stand on them.

grafik

How to do this in Roblox?

Thanks in advance!

1 Like

For what purpose will you use the effect for.

Just raycast downards from the character while whitelisting all platforms

-- local script

local RunService = game:GetService('RunService')

local Plr = game:GetService('Players').LocalPlayer

RunService.RenderStepped:Connect(function()
	local Char = Plr.Character
	local HRP = if Char then Char:FindFirstChild('HumanoidRootPart') else nil
	
	if HRP == nil or Char == nil then return end
	
	for _, platform in workspace.Platforms:GetChildren() do
		platform.CanCollide = false
	end
	
	local Params = RaycastParams.new()
	Params.FilterType = Enum.RaycastFilterType.Whitelist
	Params.FilterDescendantsInstances = { workspace.Platforms }
	
	local result = workspace:Raycast(HRP.Position - Vector3.new(0,2.5,0),Vector3.new(0,-1.5,0),Params)
	
	if result then
		result.Instance.CanCollide = true
	end
end)
1 Like

Worked! Thank you so much. I need this for a 2D Platformer I am currently programming.

How it works is mostly the way scratch creators do.
In a loop, if the Y variable is not 0 then Y *= 0.8 and then add the Y variable to mario’s Y position. Make it so when space is pressed, make sure that mario is touching a platform and if yes then, set the Y variable to 12. When mario lands, set the Y variable to 0.

I had a childhood experience with scratch before I went to roblox developing.

If it dosnt work, try experimenting some solutions that the super mario bros had used.

Ah interesting…

--------------------

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.