Hello I have this gun and it has 2 grips. These grips are where I want the hands to be holding the gun. The first grip is the trigger and the second is the end of the gun. Is it possible to do some math to automatically position the gun to move in a orientation and position where the gun moves in the character at a position where both grips of the gun are being touched by the correct hand? I’m doing this so it’s easier to animate. Right now, my system is a little out of control
Here’s my code:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAppearanceLoaded:Wait()
local gun = game.ServerStorage.Model:Clone()
gun.Parent = plr.Character
local HandRightWeld = Instance.new("WeldConstraint")
local HandLeftWeld = Instance.new("WeldConstraint")
local RightHand = nil
local LeftHand = nil
if plr.Character:FindFirstChild("Right Arm") then
RightHand = plr.Character:FindFirstChild("Right Arm")
LeftHand = plr.Character:FindFirstChild("Light Arm")
elseif plr.Character:FindFirstChild("RightHand") then
RightHand = plr.Character:FindFirstChild("RightHand")
LeftHand = plr.Character:FindFirstChild("LeftHand")
else
error("something went wrong")
end
gun:PivotTo(CFrame.new(RightHand.Position))
HandRightWeld.Parent = RightHand
HandRightWeld.Part0 = RightHand
HandRightWeld.Part1 = gun.Hand1
HandRightWeld.Parent = LeftHand
HandRightWeld.Part0 = LeftHand
HandRightWeld.Part1 = gun.Hand2
end)
Is it possible to do some math to be able to position the gun grips to always be connected to the arms?
see how the arm is outstretched to this handle peice. Is it possible to make it so both gun grips are always touching the arm in the correct spot? For example
this way I will be able to animate the characters arms and the gun will follow the animation automaticacly