I dont take any credit for this ik script the original script is in a pack Rename Script To:FastIKFabric Script:#if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; namespace peepeecaca { /// /// Fabrik IK Solver /// public class FastIKFabric : MonoBehaviour { /// /// Chain length of bones /// public int ChainLength = 2; /// /// Target the chain should bent to /// public Transform Target; public Transform Pole; /// /// Solver iterations per update /// [Header("Solver Parameters")] public int Iterations = 10; /// /// Distance when the solver stops /// public float Delta = 0.001f; /// /// Strength of going back to the start position. /// [Range(0, 1)] public float SnapBackStrength = 1f; protected float[] BonesLength; //Target to Origin protected float CompleteLength; protected Transform[] Bones; protected Vector3[] Positions; protected Vector3[] StartDirectionSucc; protected Quaternion[] StartRotationBone; protected Quaternion StartRotationTarget; protected Transform Root; // Start is called before the first frame update void Awake() { Init(); } void Init() { //initial array Bones = new Transform[ChainLength + 1]; Positions = new Vector3[ChainLength + 1]; BonesLength = new float[ChainLength]; StartDirectionSucc = new Vector3[ChainLength + 1]; StartRotationBone = new Quaternion[ChainLength + 1]; //find root Root = transform; for (var i = 0; i = 0; i--) { Bones[i] = current; StartRotationBone[i] = GetRotationRootSpace(current); if (i == Bones.Length - 1) { //leaf StartDirectionSucc[i] = GetPositionRootSpace(Target) - GetPositionRootSpace(current); } else { //mid bone StartDirectionSucc[i] = GetPositionRootSpace(Bones[i + 1]) - GetPositionRootSpace(current); BonesLength[i] = StartDirectionSucc[i].magnitude; CompleteLength += BonesLength[i]; } current = current.parent; } } // Update is called once per frame void LateUpdate() { ResolveIK(); } private void ResolveIK() { if (Target == null) return; if (BonesLength.Length != ChainLength) Init(); //Fabric // root // (bone0) (bonelen 0) (bone1) (bonelen 1) (bone2)... // x--------------------x--------------------x---... //get position for (int i = 0; i < Bones.Length; i++) Positions[i] = GetPositionRootSpace(Bones[i]); var targetPosition = GetPositionRootSpace(Target); var targetRotation = GetRotationRootSpace(Target); //1st is possible to reach? if ((targetPosition - GetPositionRootSpace(Bones[0])).sqrMagnitude >= CompleteLength * CompleteLength) { //just strech it var direction = (targetPosition - Positions[0]).normalized; //set everything after root for (int i = 1; i < Positions.Length; i++) Positions[i] = Positions[i - 1] + direction * BonesLength[i - 1]; } else { for (int i = 0; i < Positions.Length - 1; i++) Positions[i + 1] = Vector3.Lerp(Positions[i + 1], Positions[i] + StartDirectionSucc[i], SnapBackStrength); for (int iteration = 0; iteration < Iterations; iteration++) { //kzbin.info/www/bejne/i3_SiWlrhbeYnqM //back for (int i = Positions.Length - 1; i > 0; i--) { if (i == Positions.Length - 1) Positions[i] = targetPosition; //set it to target else Positions[i] = Positions[i + 1] + (Positions[i] - Positions[i + 1]).normalized * BonesLength[i]; //set in line on distance } //forward for (int i = 1; i < Positions.Length; i++) Positions[i] = Positions[i - 1] + (Positions[i] - Positions[i - 1]).normalized * BonesLength[i - 1]; //close enough? if ((Positions[Positions.Length - 1] - targetPosition).sqrMagnitude < Delta * Delta) break; } } //move towards pole if (Pole != null) { var polePosition = GetPositionRootSpace(Pole); for (int i = 1; i < Positions.Length - 1; i++) { var plane = new Plane(Positions[i + 1] - Positions[i - 1], Positions[i - 1]); var projectedPole = plane.ClosestPointOnPlane(polePosition); var projectedBone = plane.ClosestPointOnPlane(Positions[i]); var angle = Vector3.SignedAngle(projectedBone - Positions[i - 1], projectedPole - Positions[i - 1], plane.normal); Positions[i] = Quaternion.AngleAxis(angle, plane.normal) * (Positions[i] - Positions[i - 1]) + Positions[i - 1]; } } //set position & rotation for (int i = 0; i < Positions.Length; i++) { if (i == Positions.Length - 1) SetRotationRootSpace(Bones[i], Quaternion.Inverse(targetRotation) * StartRotationTarget * Quaternion.Inverse(StartRotationBone[i])); else SetRotationRootSpace(Bones[i], Quaternion.FromToRotation(StartDirectionSucc[i], Positions[i + 1] - Positions[i]) * Quaternion.Inverse(StartRotationBone[i])); SetPositionRootSpace(Bones[i], Positions[i]); } } private Vector3 GetPositionRootSpace(Transform current) { if (Root == null) return current.position; else return Quaternion.Inverse(Root.rotation) * (current.position - Root.position); } private void SetPositionRootSpace(Transform current, Vector3 position) { if (Root == null) current.position = position; else current.position = Root.rotation * position + Root.position; } private Quaternion GetRotationRootSpace(Transform current) { //inverse(after) * before => rot: before -> after if (Root == null) return current.rotation; else return Quaternion.Inverse(current.rotation) * Root.rotation; } private void SetRotationRootSpace(Transform current, Quaternion rotation) { if (Root == null) current.rotation = rotation; else current.rotation = Root.rotation * rotation; } void OnDrawGizmos() { #if UNITY_EDITOR var current = this.transform; for (int i = 0; i < ChainLength && current != null && current.parent != null; i++) { var scale = Vector3.Distance(current.position, current.parent.position) * 0.1f; Handles.matrix = Matrix4x4.TRS(current.position, Quaternion.FromToRotation(Vector3.up, current.parent.position - current.position), new Vector3(scale, Vector3.Distance(current.parent.position, current.position), scale)); Handles.color = Color.green; Handles.DrawWireCube(Vector3.up * 0.5f, Vector3.one); current = current.parent; } #endif } } }
@merklemoo84272 жыл бұрын
It will not work i am very confused
@issunnemyfavorite Жыл бұрын
what do i download to script?
@SavingForASurron1 Жыл бұрын
@Bewon9 thx so much this worked
@issunnemyfavorite Жыл бұрын
@Bewon9 im asking what do i download to be able to post the script into the script
@issunnemyfavorite Жыл бұрын
@Bewon9 rename the script to peepeecaca?
@Duckeler6 ай бұрын
at 7:52 when i do with automatic weight, it makes the arms get puffy for some reason
@Not_Laser Жыл бұрын
I had to watch it in 0.5 x speed to understand 😂
@MadeBy9K8 ай бұрын
When I join all the meshes, it turns really blocky Edit 1: I figured the subdivision surface was at 0 and I changed it to my desire, 3. Edit 2: it's not letting me name it because I named root but when I try to name neck, it says it's named root. What I mean is it is glitched. Edit 3: all you gotta do is split all of them. Edit 4: whenever I press g to move my character in blender on pose mode, it doesn't move properly.
@Milasbot10 ай бұрын
Hey I’m confused at 7:09 when his thing like get buggy mines not it’s joust moving
@johnnytoosigma Жыл бұрын
I cant get the elbow joint to bend at the end part, the bone coming off of the side of the wrist just moves my itself and its like not connected
@HMSnipes4 ай бұрын
Thanks so much I have been struggling with blender and you helped me make a really good player model thanks🎉
@MadeBy9K8 ай бұрын
Amusing. New sub
@mackerelman2788 Жыл бұрын
Most of these comments are of angry kids trying to make gtag clones with mods and stuff (DONT) and stop complaining, if you have a problem and can’t fix it REWATCH THE VIDEO I keep seeing things like I can’t bend my arms, rewatch it
@ParrotzzzDragons5 ай бұрын
when i do automatic weights my head shrinks what do i do
@Monkey122769 ай бұрын
7:22 how did you do that and have it connected? Cause when I do it doesn’t bug out it just moves the copied piece
@itzmonstrovrW Жыл бұрын
7:55 there is no "with automatic weights" button on mine.
@itzmonstrovrW Жыл бұрын
nvmnd
@kyler4932 жыл бұрын
When I do automatic weights it rotates my right arm a little and i cant move it back..
@coolestcateverr2 жыл бұрын
ctrl+z
@peelsas Жыл бұрын
in unity, my hands dont move but my body does im confused?
@thatoneguythatisepic Жыл бұрын
Do they stick to your model
@Ngbatz Жыл бұрын
You need fastikfabric for the arms to move
@JackymanWasTaken Жыл бұрын
@@Ngbatz but my game breaks when I do it
@Ngbatz Жыл бұрын
@@JackymanWasTaken same happens to me it only works sometimes
@GabrielFurryPhone Жыл бұрын
@@JackymanWasTaken skill issue
@pancakebutterpb10 ай бұрын
Where do I get the gorilla rig
@MCNUGGET-zw8tp Жыл бұрын
whenever i use automatic weight thingys my player model crumples up help
@Wolfie_Craft Жыл бұрын
I need help, when I play tested it my body was in the ground as if I was standing above my play space (which I wasn’t)
@aidjay143 Жыл бұрын
IVE REDONE THIS SO MANY TIMES RESTARTED MY PROJECT EVEN EVERYTIME I DO UR STEPS AND I PUT IT IN THE GAME AND TEST IT, MY MODEL JUST HAS THE BLACK NORMAL CHAR FROM PHOTON AND MY PLAYERMODEL IS GLITCHING OUT HELPP
@Wolfie_Craft Жыл бұрын
i added little feet to my model, but when i got to this part 7:54 and did the thing, my model glitched and the feet are floating, please help
@Roooosie316 Жыл бұрын
just dont add feet
@AlertVR Жыл бұрын
i tried putting in 0:54 subdivision Surface but my blender just crashes
@esgaming332 Жыл бұрын
you may need a better pc
@JulianGamerShortsVideos6 ай бұрын
6:22 when i try to move it it doesnt bend like it stays straight for some reason
@JTclips-v4q Жыл бұрын
im on a new version of unity so gizmos isn't there for m what do I do?
@The-Real-HuskyGT10 ай бұрын
this is not unity this is blender
@ApeLaboratory8 ай бұрын
Thank you so much, im working on a gorilla tag horror game called FunnyHamadryads. This was so appreciated!
@JoskeVR2 жыл бұрын
When I automatic weight blender keeps chrashing? yk why? And It's not cause my pc isn't strong enough cause I've got an RTX 3060 and Intel core I7
@BredYum2 жыл бұрын
possibly an out dated version of blender unsure
@JoskeVR2 жыл бұрын
@@BredYum I already fixed it
@Warrior_Studios Жыл бұрын
Can you help me, for some reason when I move the bones around in blender the bones move but not the arm
@Lixu_YT Жыл бұрын
If i try and press join there is a cube on my model
@GusFuchsia2 жыл бұрын
Yo when I do the Surface thingy in the beginning of the video the torso doesn't show up idk why. If you can help
@Emotoppywoppy2 жыл бұрын
same ;-;
@GusFuchsia2 жыл бұрын
Yeah it’s annoying
@TheStrongestLoaf4 ай бұрын
This really helped me
@ChameleonVR Жыл бұрын
@BredYum i need help on the script when i put in the hands it says: cant add script component 'FastIKFabric' because the script class cannot be found, make sure that there are no compile errors and that the file name and class dont match
@jay317jay9 ай бұрын
rename the script or check if you have errors in the console
@ProdSkimi Жыл бұрын
both of the arms bend different ways when moved the exact same way in blender when i press G. is there something i missed?
@Idkgay1436 Жыл бұрын
Help! now only i can see the player model ad other people just look invisible
@XzonClan6 ай бұрын
GUYS! THE SCRIPT IN THIS VIDEO DOES NOT WORK. THIS IS THE CORRECT SETUP SO USE THIS VIDEO FOR THE SETUP BUT THE CORRECT SCRIPT IS IN B.AWESOME’S VIDEO CALLED HOW TO ADD A 3D PLAYER MODEL TO YOUR GORILLA TAG FAN GAME!
@A5EY5 ай бұрын
Please give me more context, do I do any of the unity set up? Do I have to change the other script too?
@XzonClan5 ай бұрын
@@A5EY no the unity set up and the rigging and making blender is all correct in this video except the script in this vid doesn’t work but the one in B.Awesomes video is the same script but just doesn’t have errors
@Kirbzzy Жыл бұрын
Hey this tutorial is epic but I think you should make hands, because though there are loads of tutorials on youtube about how to make them but none of them say how to rig them, when I've tried rigging them they usually glitch out, maybe you could do a tutorial on weight painting, as I think that's the problem.
@Starvin-egg-guy Жыл бұрын
i need help. when i add the script to the hands it only goes to the hands and the upperarm
@theostguy1672 Жыл бұрын
dude when i go into pose mode my entire arm works except for upper arm, how do I fix this @BredYum
@funny_guy0 Жыл бұрын
when im trying to connect the player model to the gorilla rig, it wont show gizmos when i click on main camera. please help
@Roooosie316 Жыл бұрын
click game while its selected and there will be a gizmo button
@sirlukasade2837 Жыл бұрын
when i sideload it to my headset and play it it brings up an oculus window showing the game but i cant play it
@subhaan_PK2 жыл бұрын
Hey @BredYum so when I go to click all of them at 6:32 i cant click the bones that arent connected to the body do you know why?
@BredYum2 жыл бұрын
Are you in edit mode?
@subhaan_PK2 жыл бұрын
@@BredYum let me check
@subhaan_PK2 жыл бұрын
@@BredYum yes I am and i can click all of them except the iktarget bone and the ikpole one
@RustyLabs2 жыл бұрын
Im have the same issue can u plz help bredyum
@hubertly Жыл бұрын
i have an issue where the character just flys off the edge opf the map how do i fix this?
@spyderbytes Жыл бұрын
does anyone know why he hands are stuck above the head and cant move
@pantherraidz274011 ай бұрын
when i export it it gets all wierd and screwed up. any way to fix this?
@Squid-2 жыл бұрын
my elbows wont bend, i followed EVERY step, idk the problem
@DaveyDev2 жыл бұрын
play round with the chain length its not the same every time
@SillyVince63 Жыл бұрын
My hands are where my wrists are, is there a way I can adjust my hands so they can be on my hands instead of my wrists?
@Monkey122769 ай бұрын
Thanks so much I just got unity and blender so this will help me create my fan game
@hezar2368 Жыл бұрын
how do you fix the left arm lookin kinda weird
@smileyvrtuts Жыл бұрын
Mine says “loop in parents” HOW DO I FIX THIS! 8:10
@elyyx Жыл бұрын
select everything and do alt+p
@jaydontheyeeter1562 Жыл бұрын
How do i fix where its says bone heat weighting: failed to find solution for bone
@AZALEAdoesStuff Жыл бұрын
I need help when i flip the thing the hand armature disappears
@solforchrist2 жыл бұрын
Can you plz make a tutorial on how to make like hands w/fingers plz
@LitoMike Жыл бұрын
ok so im trying again and right now the bones are stiff at 6:22 even though they should bend
@StellaDeveloper2 жыл бұрын
How to i fix the hand postions?
@SKULLVRyt Жыл бұрын
my gorilla character doesnt have any arms or a body what do i do for the fast ik fabric
@raymikkzz Жыл бұрын
My model stretches when I put it in main camera?
@tobyteavr2 жыл бұрын
6:37 you said that the word would have an L at the end... i clicked left/right and it says R instead of L, why is that?
@BredYum2 жыл бұрын
It may be the way you rigged it
@kyler4932 жыл бұрын
select all of the bones again the go to names in armature and click flip names bam
@chimpanzeesprint2 жыл бұрын
yo i have a model can you rig it its just not working ive tried 8 times
@adasfasfsada7 ай бұрын
THANK YOU SO FU-- FREAKING MUCH IT LEGIT WORKED
@DaveyDev2 жыл бұрын
Guys To fix the whole arm not bending play round with the chain length its not the same every time!
@wheelsian9093 Жыл бұрын
Bro when I join my camera breaks and I can't remove it or fix it and I basically lost my entire game because of it, any help here?
@gl1tchvr. Жыл бұрын
I have a problem, when I try to symmetrize the bones, it’s not connected to the body, anyone know why?
@Roooosie316 Жыл бұрын
Not sure. Maybe rewatch the rigging part.
@arcticc6288 Жыл бұрын
It says the script class can't be found when I try to put it in the hand
@kirbytsbg Жыл бұрын
Same
@Chicken26261 Жыл бұрын
for some reason I can’t move my model when I place it in unity
@Ford-yt Жыл бұрын
How do you copy stuff?
@fazyvr3393 Жыл бұрын
where do u write the the script help please
@Game_Modez Жыл бұрын
where is the gorilla rig?
@LitoMike2 жыл бұрын
everything was good but it literally is just constantly tposing in unity and for some reason theres also a giant version of the model constantly following me
@maplegaming143 Жыл бұрын
Whenever I symmetrize, the shoulder bone gets disconnected from the root.
@tdunn7373 Жыл бұрын
it will still work
@notverzee Жыл бұрын
At 3:56 it won't let me select the circle to stretch it upwards
@ChameleonVR Жыл бұрын
restart the bones
@boxesithink Жыл бұрын
the upper arm wont bend like at all, ive done everything ive listened to comments but nothing will work, can anyone help me?
@keeganconcannon Жыл бұрын
when I test I see parts of the model on my screen how to I fix it? I've moved it back and forward and nothing works
@keeganconcannon Жыл бұрын
Nvm I fixed it
@Nuh-uh124522 жыл бұрын
when I try and put iktarget for the bone it doesn’t show up
@BredYum2 жыл бұрын
you may have set it up wrong or renamed it wrong re watch the video to see if you missed anything thats the main problem
@Nuh-uh124522 жыл бұрын
@@BredYumthanks
@Nuh-uh124522 жыл бұрын
@@BredYumwhen I put on automatic weights it says error loop in parents
@Dodee22_sc2 жыл бұрын
It worked! also can you bring a tutorial to put textures in it like face or that stuff?
@Airbrother93 Жыл бұрын
How do i make a script in unity
@Icequake. Жыл бұрын
Just import an image texture as base color, and do some UV editing to make it look clean
@Wintervr Жыл бұрын
@@tvvd57 i think just drag the picture on head in upperkey idk if it would work though
@redzgt9 ай бұрын
@@tvvd57extremely late, select the object you wanna put the texture on, and drag the image onto it.
@spyderbytes Жыл бұрын
Does any one know why the hands are stuck together
@somerandomahhtroller9854 Жыл бұрын
Script wont work an error pop up that says ''Can't add script component 'FastIKFabric' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.'' any know how to fix it?
@somerandomahhtroller9854 Жыл бұрын
Update: made a mistake with the script so yeah its good
@GeneralAqua10 ай бұрын
where did u get the rig?
@Braxiscool Жыл бұрын
Why when every time I use a sphere it makes my hands "see through” in a way?
@Whimsicaled Жыл бұрын
Yeah same
@OhioGyatter Жыл бұрын
when i tried to symetrize it just appeared at the other side anyone know how to fix also when it went to other side there was no ikpole either
@Nick-VR Жыл бұрын
When ever i right click it disables the one S i selectet
@dangalfvr Жыл бұрын
for some reason when i try to click ctrl P it wont work
@LionVRGT Жыл бұрын
for me only the bones are moving and not the arm and it says loop in parents?
@Phrame0 Жыл бұрын
hai lion
@crazyplayz9812 Жыл бұрын
When i Put the code in i get 2 error messages, one says about "identifier expected" on lines 3,18. and the other is "A using clause must precede all other elements defined in the namespace except extern alias declarations" on line 5,1. could someone help me with this?
@sigma_amongus Жыл бұрын
did you name it FastIKFabric
@BeanboiVR Жыл бұрын
AAAAAA WHY IS MY PLAYER MODEL SO BRIGHT IN UNITY IM BEING BLINDED
@EthanArce-cj3xr Жыл бұрын
I’m so confused when I do the part with the cube, it keeps on disappearing
@Orbzzzs Жыл бұрын
When I do automatic weight the character just gets mushed in what do I do? Any help from anyone pls?
@ObviouslyPoptart Жыл бұрын
how do you get fingers rigged
@The-BeanYT Жыл бұрын
@BredYum when i put the script on left hand and right hand nothing happens
@Evader4610 ай бұрын
The armature doesn’t move when I use your setup
@thememesterr Жыл бұрын
Is there any fix, for me it says: Cant add script component "FastIKFabric" because the script class cannot be found. Make sure that there are no complile errors and that the file name and class name match. EDIT: ive tried this tutorial several times now, ive gotten that exact error message every time???
@Catsplayzisback Жыл бұрын
I know why. You must have another FastIKFabric in your game preventing it from adding it. Hope this helps!
@MasonTheGamer2022 Жыл бұрын
I dont see the bones popping up in unity (the green outline) so it appears the script doesn't work. How do I fix this?
@DexHexVR Жыл бұрын
you might have gizmos off
@MasonTheGamer2022 Жыл бұрын
@@DexHexVR yeah. Plus, the script is sending my game into unity’s lockdown kind of thing, where I can’t run the game unless I fix something.
@MasVR09 Жыл бұрын
3:44 I don’t see an arrow on armature
@AugustXD449 Жыл бұрын
Same
@AugustXD449 Жыл бұрын
If you found out can you help me fix it if you found out how to fix it
@DaniniRacing Жыл бұрын
every time I press F2 it just turns down my volume I also tried pressing f then 2
@vozifyvr Жыл бұрын
f2 means function 2 so press fn (if u have a 60%) then press 2
@DaniniRacing Жыл бұрын
@@vozifyvr I got it fixed but thank you
@jeppewiinberg4864 Жыл бұрын
When I clicked on automatic weights the model got messed up and I cant move it
@speedyolly Жыл бұрын
What did you do at 7:56
@th3cubank1ng18 Жыл бұрын
Control p
@speedyolly Жыл бұрын
@@th3cubank1ng18 I did that but it didn't work so idk
@DarkStudios. Жыл бұрын
Uhm.. the part where u export fbx, exit blender, reload, re-import then join, is just counterproductive, what's the point? As someone who has been using blender for around 2 years, that part doesn't seem necessary
@Skeebii Жыл бұрын
hey i dont know how to import a script into unity so i need help with that
@MonkeysDelight-2023 Жыл бұрын
What is your cursor called
@eezy_vr Жыл бұрын
It wont let me right click it when I do it deselects it how do I fix that
@Thez0d1acs Жыл бұрын
bro my arm wont bend and stuff like that even though i did all ur steps someone help please