autoMATTlc
(autoMATTlc)
August 3, 2021, 9:49pm
#27
So I am very unfamiliar with IK, however, I am getting a grasp. How would I go about adding another limb?
This is the only code I changed and it works fine except the goal part is at the joint I do not want it to be at. How do I fix this?
Code:
local workspace = game:GetService("Workspace")
local storage = game:GetService("ReplicatedStorage")
local runService = game:GetService("RunService")
local goalPart = workspace:WaitForChild("GoalPosition")
local shoulderPart = workspace:WaitForChild("ShoulderPosition")
local upperArm = workspace:WaitForChild("UpperArm")
local lowerArm = workspace:WaitForChild("LowerArm")
local grapple = workspace:WaitForChild("Grapple")
local solveModule = storage:WaitForChild("SolveIK")
local solveIK = require(solveModule)
----
local SHOULDER_OFFSET = CFrame.new(1.5, 0.5, 0)
local VECTOR3_UP = Vector3.new(0, 1, 0)
----
runService.Heartbeat:Connect(function()
local shoulderCFrame = shoulderPart.CFrame * SHOULDER_OFFSET
local goalPosition = goalPart.Position
local upperV3 = VECTOR3_UP * upperArm.Size
local lowerV3 = VECTOR3_UP * lowerArm.Size
local grappleV3 = VECTOR3_UP * grapple.Size
local planeCF, shoulderAngle, elbowAngle, otherelbow = solveIK(shoulderCFrame, goalPosition, upperV3.Y, lowerV3.Y, grappleV3.Y)
local shoulderAngleCFrame = CFrame.Angles(shoulderAngle, 0, 0)
local elbowAngleAngleCFrame = CFrame.Angles(elbowAngle, 0, 0)
upperArm.CFrame = planeCF * shoulderAngleCFrame * CFrame.new(-upperV3 * 0.5)
lowerArm.CFrame = upperArm.CFrame * CFrame.new(-upperV3 * 0.5) * elbowAngleAngleCFrame * CFrame.new(-lowerV3 * 0.5)
grapple.CFrame = lowerArm.CFrame * CFrame.new(-upperV3 * 0.5) * elbowAngleAngleCFrame * CFrame.new(-lowerV3 * 0.5)
end)
Thanks!
PlentorCore
(PlentorCore)
November 29, 2021, 7:03am
#28
How would I make this R6 Because I Donāt Really See Many Posts?
vrs2210
(vrs2210)
November 29, 2021, 4:07pm
#30
It isnāt bad, itās just older.
SIayec
(Daniel)
December 2, 2021, 1:47am
#31
What am I supposed to do in this situation?
vrs2210
(vrs2210)
December 2, 2021, 7:59am
#32
What is the issue, you gotta give context instead of just showing an image and saying āWhat am I supposed to do in this situation?ā
SIayec
(Daniel)
December 2, 2021, 1:08pm
#33
Sorry, Iāve fixed the issue. I had a scripted animation playing.
Wonuf
(Wonuf)
February 28, 2022, 6:05pm
#35
Sorry for the bump!
Has anyone applied this to the module? I canāt seem to figure out where/how to apply this, testing this on a 2.0 rig is accurate enough as it is but when I test this using the woman package the arms are way off target (potentially also due to the elbow offset?)
This looks useful, and I was actually looking for inverse kinematic tutorials. But Iām still unsure about how to use it for walking in where you put the script wise or if this is even for walking. This kinda went over my head so I canāt really figure out how to use it with walking.
I might just change names or something, iām also not sure if this is only for animations instead of actual walking (For an fps game a couple friends and i are working on).
How do I use this for walking? (Or if its already for walking just tell me I donāt really know how this works)
The function provided cannot be run as it errors at :pointToObjectSpace(), the error it provides is
For the originCF im passing through a cframe, for the targetPos im passing through a position.
Iām incredibly confused any help is appreciated.
Edit: my bad i was doing something wrong
Is there anyway I could apply this to 3 joints (upper arm, lower arm, hand)?
Youtube has got ya covered
Sadly it doesnāt Iāve tried said method multiple times to no luck. Iāve covered the internet trying to find a solution yet cannot.
might be a little off topic but, why do make a variable for VECTOR3_UP instead of Vector.yAxis? Same goes for any other use youāve given it
The release of vector.yAxis is on 2021 and the tutorial is on 2019.
Also localizing your variables is always preferred for minor optimization rather than indexing it from a table using the dot notation
[image]
This is interesting, are these just constants inside their respective tables?
Could we also get Vector2.yAxis for consistency.
I also laugh at this again. [image]
3 Likes