Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Aim Animation - How to do it?

Asked by 9 years ago

So I am making a gun and I am in the final stages of development. The only thing that I really really need is an aiming animation. I cannot for the life of me figure out how to do it. I could do it the last time I made a gun, and now I can't. Things To Know 1. I have the arms welded to the head (so that they will move up and down relatively with the mouse) 2. I have the fake arms welded to the regular arms. 3. I also have the head welded to the torso to prevent the default animations from happening.

Code for the arm weld and head weld:

01local function Weld()
02    if not ArmsWelded and Player ~= nil then
03        ArmsWelded = true
04        LeftShoulder.Part1 = nil
05        RightShoulder.Part1 = nil
06        RWeld = Instance.new('ManualWeld', RightArm)
07        RWeld.Part0 = Head
08        RWeld.Part1 = RightArm
09        RWeld.C1 = CFrame.new(-0.9, 0.05, -1) * CFrame.Angles(math.rad(-90), math.rad(-16), math.rad(0))
10        LWeld = Instance.new('ManualWeld', LeftArm)
11        LWeld.Part0 = Head
12        LWeld.Part1 = LeftArm
13        LWeld.C1 = CFrame.new(0.4, 0.85, -1.1) * CFrame.Angles(math.rad(-90), math.rad(-325), math.rad(5))
14        if not HeadWelded then
15            HeadWelded = true
View all 22 lines...

Code for the fake arms:

01local function CreateArms()
02    if not ArmsCreated and S.FakeArms then
03        ArmsCreated = true
04        ArmModel = Instance.new('Model', CurrentCam)
05        ArmModel.Name = 'FakeArms'
06        --Right
07        RArm = RightArm:Clone()
08        RArm.Material = 'SmoothPlastic'
09        RArm.Transparency = S.ArmTransparency
10        RArm.BrickColor = S.ArmColor
11        local rightMesh = Instance.new('BlockMesh', RArm)
12        rightMesh.Scale = Vector3.new(0.65, 0.99, 0.65)
13        local rightWeld = Instance.new('ManualWeld', RightArm)
14        rightWeld.Part0 = RightArm
15        rightWeld.Part1 = RArm
View all 29 lines...

Thanks for the help guys. If you have anything you could tell me that might help I would greatly appreciate it.

1 answer

Log in to vote
0
Answered by
LevelKap 114
9 years ago

Alright, so i've never actually done this because i don't have the patience to find all the welds. Here's how the actual arms SHOULD move though. I drew some diagrams, disregard the first one xD.

http://imgur.com/lGl2dqF

http://imgur.com/xS7kK1v

Now, after looking at the second picture, you should be able to see how the arm should move back, while keeping the same angle that the first picture shows[pushed back at a diagonal point. pushed back on the z axis and rotated on the x axis, or vice versa(can't remember which axis from side view) ]. The only problem with this is that the arms might look weird to other players whilst in ADS. The arms will look unnaturally pushed back, but the actual player won't see it. This is really prevalent in the original battlefield game on roblox and the call of robloxia 5 (Before Phantom Forces). I hope this helped a little and i'm sorry i can't provide exact angles and such, it's too time consuming for me >.<

0
I get how the arm is like that, but when I try to edit the weld it won't work. LordSpectrus 25 — 9y
0
What do you mean? Just edit the c0 of the right shoulder LevelKap 114 — 9y
Ad

Answer this question