Look-At IK in Unity

  Рет қаралды 13,314

PabloMakes

PabloMakes

Күн бұрын

Пікірлер: 35
@thatjamguyog
@thatjamguyog Жыл бұрын
Me throughout the entire video: "I sure hope he covers returning the head to its original position." *Pablo does it "Yes! I sure hope he covers how to stop the head snapping." * Pabo does it "Yes!! I sure hope he covers how to fix the weird head rotati-" *he does it once again "Holy cow"
@CoKeHQ1
@CoKeHQ1 3 ай бұрын
Thank you so much, this works really well and is so versatile too! I wanted to avoid using humanoid lookat workflow because I wanted to use the same system for every type of creature in our game. and this is just the solution!
@michaeltyers7336
@michaeltyers7336 Жыл бұрын
I was experimenting with head/eye constraints years ago and found it unnervingly realistic to have the characters eyes switch between looking at your left and right eye occasionally when your camera is smack bang between the middle of your characters eyes.
@JCitey
@JCitey 4 жыл бұрын
This is something I really want to implement later on in my own game so this is perfect! I would really love if you would do that tutorial how to setup the point of interest list updater since I am still somewhat inexperienced how to do those kinds of things.
@inkofthedragon
@inkofthedragon 2 жыл бұрын
Phenomenal tutorial! Please do not change the formatting. Very easy to follow, clear, concise, no jargon. These types of videos are hard to find, please do not change! Excellent! Did have a question though. I put 2 POI near each other and had my player walk between. The head first tracked one POI but then quickly flicked to the second. I'm thinking it's because I walked right at the edge of both POIs radius and the rig is getting confused which to target. Any way to smooth out the look if my player notices the second nearby POI? Thanks!
@PabloMakes
@PabloMakes 2 жыл бұрын
Oops I did change the format a bit 😅 takes too long to edit! For stacking them I like making the current one stick unless you go 75% or so of the distance, number depends on your use case but that’s way if you walk between two, it will choose one and stick with it until you get further from it. That plus some keeping and it should transition nicely
@inkofthedragon
@inkofthedragon 2 жыл бұрын
@@PabloMakes thanks for getting back. My POIs are attached to enemy heads. Problem I have right now is after killing the enemy, my player keeps looking at their body on the ground. I don't want this. So far I've tried disabling the POI script on the dead enemy but that is not working. Any thoughts? Thanks again!
@PabloMakes
@PabloMakes 2 жыл бұрын
Can’t check the code right now to remember how it loops through them, but should basically need to add a check for if the gameobjects of the POI are active and if not, then disregard those
@Asier0070
@Asier0070 3 жыл бұрын
I fucking love you man.. I've been looking for this like a long long time and FINALLY! Thank you
@PabloMakes
@PabloMakes 3 жыл бұрын
Glad you found it!
@nicolasportu
@nicolasportu 2 жыл бұрын
Outstanding! You have to make a series of this :)
@inkofthedragon
@inkofthedragon 2 жыл бұрын
ok got this to work. How do I make the upper body turn (gentle weight) slightly towards where the head is looking?
@PabloMakes
@PabloMakes 2 жыл бұрын
Similar to the head but affecting a spine bone, and you can set the weight of that rig to like .3 and then change the head one to .7, so together they turn all the way
@MenelikiGaming
@MenelikiGaming 3 жыл бұрын
Not gonna lie, my first instinct when I saw you implement the eye aim logic would be to make it so that only 1 eye follows the object. Yep. I'm weird like that. lol
@PabloMakes
@PabloMakes 3 жыл бұрын
Don’t let your cross-eyed dreams be dreams
@whiskers1560
@whiskers1560 3 жыл бұрын
Cool stuff, thanks a lot.
@user-yn6xr5fd9u
@user-yn6xr5fd9u 3 жыл бұрын
thank you that video was extremely helpful
@raphaelguitarx5931
@raphaelguitarx5931 11 ай бұрын
Hi, coming from the future, could you please make an update about this? For some reason using System.Linq looks like it change in 2022.2.21 version and therefore the first statement List POIs; is marked as error: Severity Code Description Project File Line Suppression State Error CS0246 The type or namespace name 'PointOfInteres' could not be found (are you missing a using directive or an assembly reference? I tried to substitute the list with an Array yet still the Target.position is still needed to have the character work, somehow yes is working like this but the character never ends up looking at the target: using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.Animations.Rigging; public class HeadTracking : MonoBehaviour { [Header("Head Tracking Variables")] [SerializeField] private Transform Target; [SerializeField] private Rig HeadRig; [SerializeField] private float Radius = 5f; [SerializeField] private float RetargetSpeed = 5f; [SerializeField] private float MaxAngle = 80f; [SerializeField] GameObject[] EnemyPOIs; float RadiusSqr; //List POIs; //[SerializeField] List POIs = new List(); // Start is called before the first frame update void Start() { //Head tracking section //POIs = FindObjectOfType().ToList(); EnemyPOIs = GameObject.FindGameObjectsWithTag("Enemy"); RadiusSqr = Radius * Radius; } // Update is called once per frame void Update() { Transform tracking = null; foreach (GameObject enemy in EnemyPOIs) { Vector3 delta = enemy.transform.position - transform.position; if (delta.sqrMagnitude < Radius) { float angle = Vector3.Angle(transform.forward, delta); if (angle < MaxAngle) { tracking = enemy.transform; break; } } } float rigWeight = 0; Vector3 targetPOS = transform.position + (transform.forward * 2f); if (tracking != null) { targetPOS = tracking.position; rigWeight = 1; } if (RadiusSqr == 5) { Target.position = Vector3.Lerp(Target.position, targetPOS, Time.deltaTime * RetargetSpeed); HeadRig.weight = Mathf.Lerp(HeadRig.weight, rigWeight, Time.deltaTime * 2); } } }
@RedShedG
@RedShedG 3 жыл бұрын
When she 14:47, i felt that
@diogomiguel5477
@diogomiguel5477 2 жыл бұрын
Great tutorial, is it possible to get the original bone transform right before the ik?
@100redcrows
@100redcrows Жыл бұрын
Increidble tutorial! absolutely awesome, just what I was looking for, definately subscribed! I have a problem however, when writing the HeadTracking script it will tell me that PointOfInterest doesn't exist! and when trying to assign the PointOfInterest script to my "target" object, it will also say that said script (which I just created, mind you) doesn't have adequate syntax. Any tips? Thank you!!
@100redcrows
@100redcrows Жыл бұрын
Nvm, i was not using System.Linq! If this can help anybody, make sure you're not missing the 3rd line of code of the script. Cheers, and thanks again, Pablo!
@CupcakePunisher
@CupcakePunisher Жыл бұрын
@@100redcrows yeah thanks, jezus...
@danieljohnson1167
@danieljohnson1167 2 жыл бұрын
I've been having trouble with my Unity package manager where it won't load at all and times out. Is it possible to get the scripts for PointsOfInterest and Rig for the HeadRig?
@just_x_alex
@just_x_alex Жыл бұрын
Hello! I've run into some difficulties while implementing this. Can you help me?
@kristiyanaleksiev8403
@kristiyanaleksiev8403 2 жыл бұрын
What should I change on the camera look script so when you look too far on left or right the whole body turns too because it looks kinda awkward right now but a good tutorial tho thanks.
@PabloMakes
@PabloMakes 2 жыл бұрын
That’s not really something you would do here, this system is just for looking around, what you are looking for is something to move your character, so should be implemented in your character controller
@Togueznake
@Togueznake Жыл бұрын
Can yoy give the script please
@TheGamingWiccan
@TheGamingWiccan 3 жыл бұрын
how would I make my player character's camera and head bone follow the position of my mouse?
@PabloMakes
@PabloMakes 3 жыл бұрын
I assume you mean in a situation where the camera is fixed? If so, you can convert mouse position into world with ScreenToWorldPoint. Move a POI to follow that position. Hope that helps
@TheGamingWiccan
@TheGamingWiccan 3 жыл бұрын
@@PabloMakes I was thinking more like a situation where the camera would be in first person rather than third...
@PabloMakes
@PabloMakes 3 жыл бұрын
Sounds like what you need is an FPS character controller? You don’t generally have head bones in first person since you don’t have a head haha I don’t have a tutorial for FPS controller, but I think maybe there’s a brackeys one
@Mr.Epsilion
@Mr.Epsilion 3 жыл бұрын
How to rotate camera FPS with head bones , please 🥺 help
@PabloMakes
@PabloMakes 3 жыл бұрын
Sorry not sure what you mean. You don’t generally have a head in an FPS unless multiplayer for others to see or for mirrors
@SusCrow
@SusCrow 4 жыл бұрын
Projectile vomiting hype!
10 Minutes vs. 10 Years of Animation
19:29
Isto Inc.
Рет қаралды 1 МЛН
Character Controller in Unity
37:17
PabloMakes
Рет қаралды 31 М.
РОДИТЕЛИ НА ШКОЛЬНОМ ПРАЗДНИКЕ
01:00
SIDELNIKOVVV
Рет қаралды 3,4 МЛН
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 70 МЛН
Which One Is The Best - From Small To Giant #katebrush #shorts
00:17
Using IK to Improve Animations in Unity
12:05
Game Dev Guide
Рет қаралды 66 М.
Why Do Video Game Studios Avoid Blender?
6:49
The Cantina
Рет қаралды 610 М.
I Made a Graphics Engine in Scratch
8:27
Zyger
Рет қаралды 155 М.
How to work with humanoid animations in Unity
12:50
Unity
Рет қаралды 33 М.
Dear Game Developers, Stop Messing This Up!
22:19
Jonas Tyroller
Рет қаралды 716 М.
Twitch integration with Unity Tutorial
10:48
PabloMakes
Рет қаралды 15 М.
6 Years of Learning Game Development
17:20
Cobra Code
Рет қаралды 147 М.
Intro to Animation Rigging & Procedural Animation in Unity
13:33
iHeartGameDev
Рет қаралды 187 М.
How We Made The Club Penguin Avatar
24:58
Chris Hendricks
Рет қаралды 734 М.
iphone designer studio📱🤣🤣
0:16
티곰
Рет қаралды 892 М.
Как удалить компромат с компьютера?
0:20
Лена Тропоцел
Рет қаралды 2,3 МЛН
Кому новенький айфон
0:19
Новостной Гусь
Рет қаралды 523 М.
Evolution of the Samsung Galaxy
0:50
ios_aesthetics
Рет қаралды 7 МЛН