Humanoid.MoveDirection on Y Axis?

I’m trying to find the MoveDirection for y axis which I presume to be going up and down right?
But, when looking into “Humanoid”, all I notice is X and Z changing when moving side to side, forwards and backwards, but not Y when I try jumping or moving myself 1000 studs into the air and falling down.

Whats the MoveDirection for Y Axis for if you don’t go up or down?

Tried searching on Humanoid | Documentation - Roblox Creator Hub
Didn’t really get it since it only shows an example for a CameraBobble and a gif for X and Z…

EDIT: If you don’t know why I’m trying to find the Y Axis, refer to this post: Smooth Movement on Character?
Or in a nutshell, trying to apply movedirection on a slope for smooth movement going up and down with BodyForce. If theres any easier way to do this though rather than this, just tell me :stuck_out_tongue:

Shouldn’t measuring the Velocity property work? If memory serves me right, the Velocity property on the HumanoidRootPart / Torso changes if you jump or fall. The thing is, if an outside force comes along, Velocity will change, too.

You mean the velocity property in the data part of HumanoidRootPart?

Edit: This? this

Edit2: It doesnt seem to change even if I jump or fall?

It does.

Roblox Studio doesn’t update properties in realtime, from what I’ve seen.

Run this in your console while you’re in play mode, and start jumping.

game:GetService('RunService').RenderStepped:Connect(function(Step)
    print(game.Players.LocalPlayer.Character.HumanoidRootPart.Velocity)
end)

So uhh, is this suppose to happen?

I ws just thinking about using MoveDirection : Smooth Movement on Character?

To multiply it with BodyForce as a certain value to make it move more smoother. But, if i try velocity… Would it mess up alot (Look at screenshot oof)

Edit: Velocity still updates even though im standing still?

Internally the Humanoid only sets the Y component of MoveDirection when in the swimming state, it’s not used for jumping at all, jumping is specially-cased and separate from the normal walk/run/swim movement vector, that’s why you don’t see it changing. If you swim up and down, you should see it have a value, IIRC. Maybe not. I can’t remember if this is reflected in what is exposed to Lua.

3 Likes

:man_facepalming: No wonder why it didnt change at all.

Wait, so referring to the “Smooth Movement on Character?” Post, when he said to " project Humanoid.MoveDirection onto that surface’s normal plane, then move in that direction." Should I just add BodyForce that has Y automatically be set for Z and X and that would allow for smooth movement?

Projecting the MoveDirection will work well for getting the direction on the surface if it’s not too close to vertical. How you scale the force in that direction depends on the effect you want, like how much you want gravity to play a role. Adding a Y component to counter gravity probably will be smoother than just increasing the XZ force to compensate, but I haven’t done this comparison.

Thanks for the help, I’ll see what I could do.