You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make the player’s legs face a different direction than the player is looking, preferably towards its moveDirection. I need this to make walking seem more natural in my game (walking backwards, forwards, sideways, etc.)
What is the issue? Include screenshots / videos if possible!
When I try to rotate the legs with CFrame.lookAt, the entire torso rotates with it. I really have no clue on what to do next.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried using CFrame.lookAt and looking towards other games for inspiration, the main ones are Embrithas by Davidii and Evade by Hexagon Development Community (but less advanced I just want to make the legs face a different direction.)
I need to do this:
But in script, thanks for anyone who ever tries to help
There are Motor6Ds parented under the Torso of an R6 character. You could modify the values of those to get the effect you want. Specifically “Left Hip” and “Right Hip”.
Here is a start:
local leftLeg = script.Parent.LeftUpperLeg.LeftHip
local rightLeg = script.Parent.RightUpperLeg.RightHip
local angle = 0
local centerOfLegs = Vector3.new(0,-.2,0)
mag = .5
while wait(.001) do
angle += math.rad(1)
leftLeg.C0 = CFrame.new(centerOfLegs) * CFrame.new(math.cos(angle) * mag, 0, math.sin(angle) * mag) * CFrame.Angles(0,-angle,0)
rightLeg.C0 = CFrame.new(centerOfLegs) * CFrame.new(math.cos(angle + math.rad(180)) * mag, 0, math.sin(angle+ math.rad(180)) * mag) * CFrame.Angles(0,-angle - math.rad(180),0)
If you put this code into an R15 model, it will rotate the legs together. All you need to do is find the angle between where the player is moving, and where the torso is looking, then input that angle into this equation. I do want to warn you that values like the centerOfLegs, and mag were set by me for my specific R15 character, you will need to have those dynamically set by your code.
Oh my god thank you so much, I’ve been looking everywhere.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.