Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Lock the arm into a specific position?

Asked by
Veyrek 5
7 years ago
Edited 7 years ago

Let's say we have point A(start), and point B(finish) If I change B position, it'll update along A, giving this lock-effect. Same goes for the arm, attached to an particular part and whenever the part position is changed it'll change along with the arm I've heard you must use inverse kinematics to achieve such a thing, but I'm afraid I have no idea how to work with it, what should I use to achieve this?

Example : https://www.roblox.com/games/415579843/Pew-Pew-Demo-REWRITE

Notice how the left arm is locked to the grip of the weapon

2 answers

Log in to vote
2
Answered by 7 years ago

Hello Veyrek,

I did do inverse kinematics, but my method is way easier than standard inverse kinematics. I have two parts: one welded to the gun, and one welded a bit to the left of the head. I cframed the arm at the hand, facing towards the shoulder, and then inversed it in order for it to face forward. Then, i multiply that by an offset of half the arm's length in order for the front of the arm to be where the hand part is. This works in that the front of the arm will always be touching the hand part, while the back of the arm will always be facing the shoulder part, no matter how close/far the shoulder part is. This process happens once per frame, per arm. All it is is basic CFrame. Hopefully this helps,

PreacherCapital

0
Aight I get it, pretty thanks tho! Veyrek 5 — 7y
Ad
Log in to vote
1
Answered by
EgoMoose 802 Moderation Voter
7 years ago

Inverse kinematics is a tricky beast as there are quite a few ways to solve it and most of them tend to be a bit challenging (but not all!).

For arms the simplest approach is to use law of cosines which will prob be good for you if you know your trig. I tend to use this alongside Rodriguez rotation if I'm doing stuff in world space, but if you aren't you can easily get away with joint manipulation.

This is a decent explanation for that approach, although keep in mind it's relatively limited to very simple systems (like elbows): http://www.oliverjenkins.com/blog/2012/9/inverse-kinematics-and-robot-arms

If you're looking for a more multi-purpose approach I always recommend FABRIK (which I wrote about here: http://wiki.roblox.com/index.php?title=Inverse_kinematics) b/c it doesn't require knowledge of matrices and/or calculus.

You have to keep in mind though that every Inverse kinematic approach has both flaws and weaknesses so depending on how you set it up law of cosines or FABRIK might be harder or easier depending on the situation. That however if for you to do research on and decide.

Answer this question