Help with animating a tool (motor6D)

  1. I’m trying to animate my tool

  2. The base position is weird

  3. I tried searching on internet and fixing the issue myself

video :

my script :

local Tool = script.Parent
local Character = workspace:WaitForChild(Tool.Parent.Parent.Name)
local Humanoid = Character.Humanoid

local Event = game.ReplicatedStorage.Tools.Gun
local PreHoldAnim = Tool:WaitForChild("PreHoldAnim")
local HoldAnim = Tool:WaitForChild("HoldAnim")
local ShootAnim = Tool:WaitForChild("ShootAnim")
local PreHoldTrack = Humanoid.Animator:LoadAnimation(PreHoldAnim)
local HoldTrack = Humanoid.Animator:LoadAnimation(HoldAnim)
local ShootTrack = Humanoid.Animator:LoadAnimation(ShootAnim)

local BodyAttach = Tool.BodyAttach.BodyAttach
--local BasePosition = Vector3.new(math.rad(90),math.rad(-180),math.rad(0))

Tool.Equipped:Connect(function()
	BodyAttach.Part0 = Character.RightHand
	--BodyAttach.Enabled = true
	
	--PreHoldTrack:Play()
	--PreHoldAnim.Stopped:Wait()
	HoldTrack:Play()
end)

Tool.Unequipped:Connect(function()
	
	--BodyAttach.Enabled = false
	
	HoldTrack:Stop()
end)

Tool.Activated:Connect(function()
	ShootTrack:Play()
end)

By the way, I don’t use a handle

Does anybody know how to make the very first position (the motor 6D when it get connected to the hand) as I want ??

There is no way to fix that to my knowledge, the weapon will always stick to the arm. Anyway, you could make a stance animation and play it or add the Motor6D when the animation is supposed to play.

Use Anim:AdjustSpeed(0) to pause stance.

I mean, is it possible to change the position and orientation of the motor6D when it just got linked so the orientation and position looks normal ?

You can, I believe there is a property like C0 or C1 but that’s really just stressing and inaccurate to depend on.

In your case I’d pause the stance animation.

Pause the animation ? Could you explain ? (sorry if I’m annoying, I’m just really bad)

There is no need to consider yourself annoying.

By pausing animation I meant whenever the animation is about to end you would use anim:AdjustSpeed(0) to make it stop moving. So it will make it stop at a specific time.

Example

Anim:Play()

wait(0.9)
Anim:AdjustSpeed(0)

1 Like

Last question, is there a way to make the animation happen without any linear interpolation ? So it directly go to the wanted position.

Edit : Thanks a lot for your help !

1 Like

I don’t quite understand but I will assume you don’t want the hand to move this slow. You can adjust the animation keyFrame to the very beginning of the editor and it should play instantly

If you’d like further assistance let me know.

Oh, sorry if i wasn’t clear enough. My idea is to make happen the animation without any interpolation. So it moves to the target position directly / instantly.

Or maybe it’s possible to set the C1 of the motor6D with some script to the wanted default position without affecting the animations.

Is that clear enough ? If not, please make me know.

Edit : Thank you !!

1 Like

Yes what I said would do that instantly. The KeyFrame at the very beginning is the starting position, meaning there is nothing to animate and it will instantly go there.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.