Procedural Animation Help

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:
image

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()
1 Like

You may need to adjust the position and rotation of each joint by a certain amount based on the current frame of the animation.

One approach could be to use inverse kinematics, which involves positioning joints by working backwards from the end effector (the “hand,” in this case) to the root of the arm. This can be done using trigonometry to calculate the angles of each joint based on the desired position of the end effector.

Another approach could be to use forward kinematics, which involves positioning joints by working forwards from the root to the end effector. This can be done by calculating the position and rotation of each joint based on its parent joint’s position and rotation, as well as any changes in position or rotation caused by the animation.

1 Like