How can i detect player moving/flying direction

How i can always detect when player moving or flying (when apply force(bodyvelocity) on him) direction and do raycast for check when player touch the ground like in this video? :

Please help if you can and sorry for my english (i use translator)

2 Likes

Use HumanoidRootPart.Velocity for that. It updates correctly and does tell you movement direction. For movement respected to another Vector I think its like VectorToObjectSpace? I don’t remember.

4 Likes

I figured out how to do this, thank you very much!


For those who are also interested in this and do not understand, here is my script:

local part = Instance.new("Part",workspace)
	
	coroutine.wrap(function()		
		while true do
			if breaker ~= true then
			print(who:FindFirstChild("HumanoidRootPart").Position + who:FindFirstChild("HumanoidRootPart").Velocity)
			part.Position = who:FindFirstChild("HumanoidRootPart").Position + who:FindFirstChild("HumanoidRootPart").Velocity
			part.CFrame = CFrame.lookAt(who:FindFirstChild("HumanoidRootPart").Position,who:FindFirstChild("HumanoidRootPart").Position + who:FindFirstChild("HumanoidRootPart").Velocity)
			part.Size = Vector3.new(1,1,5)
			part.Anchored = true
			part.CanCollide = false
			task.wait(0.1)
			else
				break
			end	
		end
	end)()	
1 Like

No probs glad your solution is done!

2 Likes

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