I’m using this directional movement system and wondered, is there a way to keep the arms centered when using said directional movement system. Just so the gun always stays centered.
here’s a video of what it looks like currently.
as you can see, the arms are not centered. Is there any fix?
code:
No I haven’t implemented the code for the arms yet, but I did try, the arms inversed correctly. But their offset is still off, since one arm is ahead of the other.
I meant you do* my english is a bit off. Anywho what most systems do is instead of having the arms be directly connected still to torso you make another part like AnimRoot or wtv and connect it to the HumanoidRootPart, and have it’s movement handled by a Motor6D. That might fix your issue.
Hey quick question, I made a new rig where the arms follow such rig, only downside to this is I attached it to the head instead of the root so it won’t look weird with walking and such. Is there any way to fix this weird rotational thing, the arms are perfectly center. Then get more distorted as I look up/down
function Calculate( dt, HumanoidRootPart, Humanoid, Torso, Local)
local DirectionOfMovement = HumanoidRootPart.CFrame:VectorToObjectSpace( HumanoidRootPart.AssemblyLinearVelocity )
DirectionOfMovement = Vector3.new( DirectionOfMovement.X / Humanoid.WalkSpeed, 0, DirectionOfMovement.Z / Humanoid.WalkSpeed )
local XResult = ( DirectionOfMovement.X * (RangeOfMotion - (math.abs( DirectionOfMovement.Z ) * (RangeOfMotion / 2) ) ) )
local XResultTorso = ( DirectionOfMovement.X * (RangeOfMotionTorso - (math.abs( DirectionOfMovement.Z ) * (RangeOfMotionTorso / 2) ) ) )
local XResultXZ = ( DirectionOfMovement.X * (RangeOfMotionXZ - (math.abs( DirectionOfMovement.Z ) * (RangeOfMotionXZ / 2) ) ) )
if DirectionOfMovement.Z > 0.1 then
XResult *= -1
XResultTorso *= -1
XResultXZ *= -1
end
local RightHipResult = RightHipOriginalC0 * CFrame.new(-XResultXZ, 0, -math.abs(XResultXZ) + math.abs( -XResultXZ ) ) * CFrame.Angles( 0, -XResult, 0 )
local LeftHipResult = LeftHipOriginalC0 * CFrame.new(-XResultXZ, 0, -math.abs(-XResultXZ) + math.abs( -XResultXZ ) ) * CFrame.Angles( 0, -XResult, 0 )
local RootJointResult = RootJointOriginalC0 * CFrame.Angles( 0, 0, -XResultTorso )
local NeckResult = NeckOriginalC0 * CFrame.Angles( 0, 0, XResultTorso )
local LerpTime = 1 - LerpSpeed ^ dt
local CameraDirection = HumanoidRootPart.CFrame:toObjectSpace(Camera.CFrame).lookVector
-- apply C0
Torso['Right Hip'].C0 = Torso['Right Hip'].C0:Lerp(RightHipResult, LerpTime)
Torso['Left Hip'].C0 = Torso['Left Hip'].C0:Lerp(LeftHipResult, LerpTime)
HumanoidRootPart.RootJoint.C0 = HumanoidRootPart.RootJoint.C0:Lerp(RootJointResult, LerpTime)
-- New line I added that makes the head follow the directional CF, while also rotating with the camera.
local CameraCF = CFNew(0, YOffset, 0) * CFAng(3 * math.pi/2, 0, math.pi) * CFAng(0, 0, -asin(CameraDirection.x)) * CFAng(-asin(CameraDirection.y), 0, 0)
Torso.Neck.C0 = Torso.Neck.C0:Lerp(CameraCF * CFrame.Angles( 0, 0, XResultTorso), LerpTime)
end