I don't understand raycasting

I know how to raycast simply but I don’t know how to use it for other stuff. I wanna use it to detect when a part hits the ground or when your in the air.

I learned from it,
you can learn raycasting + how to make a minigun

if you want to detect if a player is in the air, just do this

repeat wait() until script.Parent.Humanoid

script.Parent.Humanoid.StateChanged:Connect(function(oldState, newState)
	if newState == Enum.HumanoidStateType.Freefall then
		print("player is falling")
	end
end)

(LocalScript from StarterCharacterScripts)

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		print("a character touched in the part")
	else
		print("something touched the part")
	end
end)

(Script from Part)

This is deprecated. And I already know how to raycast but I mean how do I apply this knowledge to detect when something hits the floor or is in the air

also if you want to detect every single moment that the player is in the air you must make a loop for it.

can you explain what are you trying to do and not what you need to do? if so I can help you with you’re trying to do and it will help you at your development of the game