Trying to make a Procedural Animation System.
I’m using the Joint’s Transform property, copied from a cframe on every step. I’m not sure how to adjust the math to get what i want. Any help would be very much appreciated.
This is the result I want.
and this is the Result I’m getting:
local EndLocation = Mouse.Hit.Position
--[[Making a part]]
local Metapart = Instance.new("Part",workspace)
Metapart.CanCollide = false
Metapart.CanQuery = false
Metapart.Size = Vector3.new(1,1,1)
Metapart.Anchored = true
Metapart.CFrame = Character.RightUpperArm.CFrame
--[[Part Tween]]
local Info = TweenInfo.new(0.25)
local Goal = {}
Goal.Position = EndLocation + (Vector3.new(3,3,3)*Character.Head.CFrame.LookVector)
local MetapartTween = TweenService:Create(Metapart, Info, Goal)
MetapartTween:Play()
MetapartTween.Completed:Wait()
--[[Part Tween End]]
--[[Arm Tween]]
local TweenInfoA = TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)
local Goal2 = {}
local Dist = (J.C0.Position - (Metapart.Position))
local Angle = math.atan2(Dist.Z,Dist.X)
Goal2.Value = CFrame.new(0,0,0) * CFrame.Angles(Angle,0,0)
local Tween2 = TweenService:Create(CFrameValue, TweenInfoA, Goal2)
Debounce = true
Tween2:Play()