Hey! So I’ve found a major issue in regards to utilizing animations alongside a player-cursor movement system. This issue arises when the player utilizes the player-cursor movement system, whilst the animation is actively playing. An example of what is intended to happen, along with the issue, is present in the video below:
Does anybody understand why this is happening? The only known difference between both of these examples, only consists of the animations themselves.
Any/all help is HEAVILY appreciated!
(To clarify, the issue arises at 0:06 within the provided video, everything before is what was intended to occur)
I’m also really new to this stuff, so if there’s any issues with this anyways, then just lmk, I’m open to learning.
Second, I’m not exactly sure what your issue is here but it seems you aren’t happy with the fact that the body doesn’t turn fully towards the mouse in some situations?
Honestly, I wouldn’t mind it. But I’m not sure of the solution either, code should be provided.
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local tweenService = game:GetService("TweenService")
local UIS = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local char = Player.Character or Player.CharacterAdded:Wait()
local origRightS = char:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder").C0
local origLeftS = char:WaitForChild("LeftUpperArm"):WaitForChild("LeftShoulder").C0
local m = Player:GetMouse()
local Ang = CFrame.Angles
local aSin = math.asin
local aTan = math.atan
local Plr = game.Players.LocalPlayer
local Mouse = Plr:GetMouse()
local Head = char:WaitForChild("Head")
local Hum = char:WaitForChild("Humanoid")
local Core = char:WaitForChild("HumanoidRootPart")
local Trso = char:WaitForChild("UpperTorso")
local Neck = Head:WaitForChild("Neck")
local Waist = Trso:WaitForChild("Waist")
local HeadHorFactor = .7
local HeadVertFactor = 0.7
local BodyHorFactor = 0.7
local BodyVertFactor = 1
local NeckOrgnC0 = Neck.C0
local WaistOrgnC0 = Waist.C0
Neck.MaxVelocity = 1/3
local IsEquipped = false
local guh = false
game:GetService("UserInputService").InputBegan:Connect(function(Key,IsTyping)
if IsTyping then return end
if Key.KeyCode == Enum.KeyCode.Q then
if guh == false then
IsEquipped = true
guh = true
elseif guh == true then
IsEquipped = false
guh = false
end
end
end)
RunService.RenderStepped:Connect(function()
if IsEquipped then
local rightShoulder = char.RightUpperArm:FindFirstChild("RightShoulder")
local leftShoulder = char.LeftUpperArm:FindFirstChild("LeftShoulder")
if rightShoulder then
rightShoulder.C0 = rightShoulder.C0:Lerp(CFrame.new(1, .65, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y), 0, 0), 0.1)
end
if leftShoulder then
leftShoulder.C0 = leftShoulder.C0:Lerp(CFrame.new(-1, .65, 0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y), 0, 0), 0.1)
end
if char["UpperTorso"] ~= nil and char["Head"] ~= nil then
local TrsoLV = Trso.CFrame.LookVector
local HdPos = Head.CFrame.p
if Neck and Waist then
local Point = Mouse.Hit.p
local Dist = (Head.CFrame.p - Point).magnitude
local Diff = Head.CFrame.Y - Point.Y
Neck.C0 = Neck.C0:lerp(NeckOrgnC0 * Ang(-(aTan(Diff/Dist) * HeadVertFactor), (((HdPos - Point).Unit):Cross(TrsoLV)).Y * HeadHorFactor, 0), .2)
Waist.C0 = Waist.C0:lerp(WaistOrgnC0 * Ang(-(aTan(Diff/Dist) * BodyVertFactor), (((HdPos - Point).Unit):Cross(TrsoLV)).Y * BodyHorFactor, 0), .2)
end
end
else
local rightShoulder = char.RightUpperArm:FindFirstChild("RightShoulder")
local leftShoulder = char.LeftUpperArm:FindFirstChild("LeftShoulder")
if rightShoulder then
rightShoulder.C0 = rightShoulder.C0:Lerp(origRightS, 0.1)
end
if leftShoulder then
leftShoulder.C0 = leftShoulder.C0:Lerp(origLeftS, 0.1)
end
if Neck then
Neck.C0 = Neck.C0:Lerp(NeckOrgnC0, 0.1)
end
if Waist then
Waist.C0 = Waist.C0:Lerp(WaistOrgnC0, 0.1)
end
end
end)
Note: the scripting works flawlessly, there is only issues in regards to the animations! The script works to only move the uppertorso + head, I have no idea where the movement of the arms come in.
I would also like to add that the issue only arises when a specific animation is used, and not in the original animation. It’s a little confusing on my end lol.
I have found that when using older roblox animations, the issue isn’t present. It’s quite odd.
I’ll see if I can use such as a base for other animations (and if this does work out, then I guess I have a temporary solution).
Modifying the animation (18907504447) or even exporting such in general doesn’t allow the solution to be present. The issue still persists oddly enough.
I have found the solution! The reason the old animations worked so well was because they had not contained any HumanoidRootPart poses (Example attached).
If you isolate these poses from the main keyframe sequence, then the desired effect is achieved!
(I have also found that “RigData” attached to such also seems to cause issues)
It could be one or the other tbh, but i was too lazy to look completely into it. All I know, is that removing one of them (for me, both) works.