Socks347
(Socks347)
August 5, 2021, 11:01pm
#1
Not sure why this is erroring? Edit: Error on the line that says “Shoulder.Transform = Plane * CFrame.Angles(ShoulderAngle, 0, 0)”
local SolveIK = require(game.ReplicatedStorage.Modules.SolveIK)
local Plane, ShoulderAngle, ElbowAngle = SolveIK(CFrame.new(), HandTarget, UpperArmLength, LowerArmLength)
Shoulder.Transform = Plane * CFrame.Angles(ShoulderAngle, 0, 0)
Elbow.Transform = CFrame.Angles(ElbowAngle, 0, 0)
2 Likes
Can you send a screenshot of the error
1 Like
Socks347
(Socks347)
August 5, 2021, 11:32pm
#3
the title is the error that i am getting :DDD, on the line with shoulder.transform
1 Like
What is SolveIK
returning?
Socks347
(Socks347)
August 6, 2021, 12:19am
#5
solveik is set to local SolveIK = require(game.ReplicatedStorage.Modules.SolveIK)
Cool. So what is that function returning?
can you pls send the module script you called for this
Socks347
(Socks347)
August 6, 2021, 1:04am
#8
They return positions of where they are the module returns CFrame Plane, Radian Shoulder angle, Radian Elbow angle
Socks347:
CFrame.new()
this the problem. your supposed to give x,y,z
You’re using the values that are returned from your function call to compute new values, but the function is not returning anything for either Plane
or ShoulderAngle
.
Socks347
(Socks347)
August 6, 2021, 1:23am
#11
Module returns return planeCF, a1 + math.pi/2, a2 - a1
RVCDev
(commitcookies)
August 6, 2021, 1:28am
#12
Try printing ShoulderAngle, I think the error came from CFrame.Angles on the X place
Socks347
(Socks347)
August 6, 2021, 1:30am
#13
RVCDev
(commitcookies)
August 6, 2021, 1:33am
#14
Is nil
the printed shoulder angle?
1 Like
Socks347
(Socks347)
August 6, 2021, 1:34am
#15
Yup, that did happen until 3rd try really, or the end
RVCDev
(commitcookies)
August 6, 2021, 1:46am
#16
Then check if ShoulderAngle
is nil like
local Plane, ShoulderAngle, ElbowAngle = SolveIK(CFrame.new(), HandTarget, UpperArmLength, LowerArmLength)
ShoulderAngle = ShoulderAngle or 0
Shoulder.Transform = Plane * CFrame.Angles(ShoulderAngle, 0, 0)
Elbow.Transform = CFrame.Angles(ElbowAngle, 0, 0)
Socks347
(Socks347)
August 6, 2021, 1:47am
#17
RVCDev:
local Plane, ShoulderAngle, ElbowAngle = SolveIK(CFrame.new(), HandTarget, UpperArmLength, LowerArmLength)
ShoulderAngle = ShoulderAngle or 0
Shoulder.Transform = Plane * CFrame.Angles(ShoulderAngle, 0, 0)
Elbow.Transform = CFrame.Angles(ElbowAngle, 0, 0)
Then it completely breaks, this is a hand moving system using controller
RVCDev
(commitcookies)
August 6, 2021, 1:51am
#18
Save the last ShoulderAngle, if its nil then set it to that?
CFrame.new with no arguments creates a new CFrame with an identity matrix. That wouldn’t be the issue.
That is actually the only operation you can do on CFrames. Add, subtract, and divide do not work, whereas multiply does.
1 Like