Animation mouse input

How would I tween between 2 animations with input like mouse Y going from -1 to 1?
Like blend the animations I guess you could call it.

Example ^^ Mouse Y would be 0 like this, -1 would go down and 1 would go up.

How would I do that?

1 Like

Well I feel like getting the angle between where you mouse is relative to where your player is would be a better option

So then youd be able to check if the mouse is between the min and max angles then like set it to the regular animation and so on for the other two

Hey again, I tried to recreate what I explained in my previous reply!

Basically I’m getting the angle between the mouses lookvector and the root parts lookvector and then converting that to degrees, so now you can use logic to determine when each animation shoud play deepending on the angle

Youll probably have to play with the angle logic though

local v1 = root.CFrame.LookVector.Unit
local v2 = mouse.Hit.UpVector.Unit

local angle = math.deg(math.acos(v1:Dot(v2)))
print(angle)

if angle > 90 then
  
elseif angle < 90 then

end

but how would i bend the arm itself using animations? that’s the part that i don’t know how to do

Oh youd just switch the arm animation depending on the angle

You can just check if the Y axis of the Mouse is above the center or not.

local Plr = game:GetService("Players").LocalPlayer
local MS = Plr:GetMouse()

local Camera = workspace.CurrentCamera

local Center = Camera.ViewportSize / 2

if MS.Y > Center.Y then
    -- Play up animation
else
    -- Play down animation
end
1 Like

first: make the two animations connect
second: there are many tutorials where they explain the movement of the mouse ( userinputservice )
If you can’t find it, look in the Spanish category.
third: put a solution to this comment

but how would i manipulate the animation with the mouse.y? if i set it to play up animation my arm would be facing fully up if its in above the center same for down, its not gonna point to the mouse, + im using first person so this wouldn’t really work

1 Like

Oh, it’s first person? Then just check if the Mouse.Hit.Position.Y is greater than Plr.Character.Head

-- LocalScript in StarterPlayerScripts, I haven't tested this so you might have to change something
local RunService = game:GetService("RunService")

local Plr = game:GetService("Players").LocalPlayer
local MS = Plr:GetMouse()

local up
local down

function updateTracks()
    local Anim:Animator = Plr.Character:WaitForChild("Humanoid"):WaitForChild("Animator")

    up = Anim:LoadAnimation(script.UpAnim)
    down = Anim:LoadAnimation(script.DownAnim)
end

Plr.CharacterAdded:Connect(updateTracks)

repeat task.wait() until Plr.Character

updateTracks()

RunService.RenderStepped:Connect(function()
    if Plr.Character == nil or (Plr.Character and not Plr.Character:FindFirstChild("Head")) then return end

    if up and down then
        if MS.Hit.Position.Y > Plr.Character.Head.Position.Y then
            if not up.IsPlaying then
                up:Play()
                down:Stop()
            end
        else
            if not down.IsPlaying then
                down:Play()
                up:Stop()
            end
        end
    end
end)

Still an issue because the mouse just goes instantly up as I mentioned above here’s a video

https://gyazo.com/0781a6184a7c857200d587224c3d865a

I need it to point where the mouse is