Getting the Character to Angle Based on Movement

How would I make the player’s character angle itself based on the humanoid’s movedirection [e.g tilting the character slightly right when the character moves right], like in Adventure Story by vetexgames? [Adventure Story! - Roblox]

Example
https://streamable.com/m2acv

1 Like

Sure! I think it brings something unique and creative to the game. I like it!

I thought it already does, but if you mean that moving sideways angles the torso of the character, I can think of 2 ways:

Using and animation - Use two animations to rotate the character to the right or to the left
Using Vectors/CFrames - Manually rotate the character

When the player presses the w or d key, play the animations or set the cframe/vector

1 Like

Yes, that could work. However, I’m looking for a more in depth explanation as I don’t really know where to start with that.

Let’s try using the animations:

Make two animations, one with he torso tilted to the right, and one to the left

Export both animations and record the asset Id’s


In a local script inside the StarterCharacterScripts, load both animations into the humanoid
Reference the UserInputService

When the player presses the a key, play the animation with he torso to the left(and make sure to repeat the animation), and vice versa

2 Likes

Wouldn’t using the method of keypresses make it not work with mobile players? Is there some way you can determine if they’re moving right or left with movedirection?

Sorry, but I’m not very good for anything with mobile, maybe take a look into ContextActionService and UserInputService.

So sorry I couldn’t help.

It’s alright, but I’ll try your method anyways. Thanks!

1 Like

Would you mind detailing the CFrame/Vector version? Animations wouldn’t really work considering I’m already using custom animations that would look wonky if interrupted for a new animation that tilts.

I will try to figure it out, I am in the process.

Here’s a horrifying thing that I did to my character:
Don’t look, it will scar you

Capture

wonder how i did that?

local UIS = game:GetService("UserInputService")

local torso = script.Parent.UpperTorso

UIS.InputBegan:Connect(function(Input)

    if Input.KeyCode == Enum.KeyCode.A then

        torso.Orientation = torso.Orientation + Vector3.new(0, 0, 10)

    end

end)

UIS.InputEnded:Connect(function(Input)

if Input.KeyCode == Enum.KeyCode.A then

torso.Orientation = torso.Orientation - Vector3.new(0, 0, 10)

end

end)

Ill get back to you when I figure it out.
Or, you can try to get a sense of what I am doing and try figuring it out.

2 Likes

Your creation is absolutely beautiful.

2 Likes

Funny how I forget it when it’s most relevant. I believe the proper term for this is character momentum and that there’s a resource somewhere that allows you to do this. Don’t do it with animations because they’ll override other ones or get countermanded. It has to do with lerping some of the joints relative to the direction of movement. Can’t recall at all what it is.

There’s this recent post on what seems to be the same topic:

Will let you know if I find anything.

6 Likes

[Updated] Open-Source R15/R6 Character Momentum/Leaning I found it, here you go man (props to the dude who made this)