The clarity in both what you're doing and how is actually AMAZING, thank you so much
@KetraGames2 жыл бұрын
Thanks very much for this comment 😊
@IroquoisPliskin863 жыл бұрын
Fantastic tutorial. Just a pleasant sounding voice explaining exactly what you need to do with no filler, no mistakes that you get a lot when people film them live, just the tutorial and the code and what it does. This is how every Unity tutorial should be. Well done.
@KetraGames3 жыл бұрын
Love this comment! Thank you 😊
@user-ez7ls2du9c2 жыл бұрын
Thats great now do it with a rigidbody. transform.Translate does nothing with physics, so this code "works" but its useless 99% of the time unfortunately
@jahoopyjaheepu4972 жыл бұрын
@@user-ez7ls2du9c I'm using this code in a very similar way with a kinematic rigidbody. It is not useless; you just don't understand how to use rigidbodies and transform together.
@akhilkrishna52823 жыл бұрын
Thank u soo much, i searched a lot in google and youtube and u were the only one to have a good video about the rotation........hope ur channel grows lot as people like u really deserve it......lots of thanks
@KetraGames3 жыл бұрын
Thanks so much for this! That's great to hear 😊
@casuallyaddicting64523 жыл бұрын
Thank you so much for the 2d rotation! Hope your channel grows fast.
@KetraGames3 жыл бұрын
Thanks 😊
@TheOnlyOwnedbyCow3 жыл бұрын
Thank you! I've went through a ton of tutorials trying to find someone that actually uses Unity 2d the way that it is set up. You are the only person that I have found that use X and Y for movement and X for rotation. It took me about 6 hours to find your video. You had the exact solution that I was needing. Good job! Subbed.
@KetraGames3 жыл бұрын
Thanks for this. Glad it was helpful 😊
@DarkHunterThany Жыл бұрын
Thank you!! I was stuck on this for hours then had it fixed in minutes thanks to your video.
@franchisethebull2 жыл бұрын
Hey, very concise and useful tutorial, was able to adapt it to what I needed for my code very quickly. Thank you champ
@KetraGames2 жыл бұрын
Thanks for this comment, good to hear 😊
@volkerherfeld32253 жыл бұрын
Thanks a lot! This is a great tutorial that fixes a problem I've been having with a top-down tank game!
@KetraGames3 жыл бұрын
Glad you found it useful 😊
@goodgamershow65053 жыл бұрын
Thank you very much for your tutorial, it helped me really well. I thought programming rotation would be much harder, but you solved my problem with just 2 lines of code, lol. UPD: If anybody faces a problem with player not rotating, make sure your "Rotation Speed" variable is assigned and have a really big value. For me value of 3500 was just great, because in my game player needs fast rotation.
@KetraGames3 жыл бұрын
Glad to hear this, thanks for your comment 😊
@vincn97602 жыл бұрын
i was struggling to do this for so long. no finally I got it working. Thank you so much
@KetraGames2 жыл бұрын
Great to hear, thanks 😊
@iml-ilustresmemeslegendado35543 жыл бұрын
Thank you VERY much. Exactly what i was looking for. I was crazy searching about it. God bless you and your channel
@KetraGames3 жыл бұрын
Great to hear this. Thanks very much for your comment 😊
@mathiasaxelsson78422 жыл бұрын
Thank you for this! This was the exact kind of rotation for my enemy I wanted to achieve. However in my case I needed the an enemy rotate towards the player without snapping directly to the player direction.
@KetraGames2 жыл бұрын
Great to hear, thanks 😊
@andrewfedorov91982 жыл бұрын
Such a good and clean tutorial. Thank you!
@KetraGames2 жыл бұрын
Thanks for this comment 😊
@frederick77953 жыл бұрын
Perfect, exactly what I'm looking for
@KetraGames3 жыл бұрын
Glad you found it useful 😊
@Myzzz122 жыл бұрын
This is exactly what I needed, thanks!
@KetraGames2 жыл бұрын
Great to hear 😊
@sonesaile2 жыл бұрын
Exactly what I needed. Thank you. Great tutorial.
@KetraGames2 жыл бұрын
Glad it was useful 😊
@RainZzxHDx Жыл бұрын
Easy and Quick to understand. Thanks for the good Tutorial 😁
@KetraGames Жыл бұрын
Great to hear, thanks 😊
@se5d Жыл бұрын
thank you. exactly what i was looking for
@KetraGames Жыл бұрын
Great to hear 😊
@hahumbra Жыл бұрын
Excellent explanation. Thanks
@KetraGames Жыл бұрын
Great to hear 😊
@rgodoy86 Жыл бұрын
Lifesaver, many thanks!
@umgefallenesglas82133 жыл бұрын
THANK YOU THAT WAS WHAT I NEEDED
@KetraGames3 жыл бұрын
Great, glad it was useful 😊
@DARÉ_REBELO3 жыл бұрын
thanks very much. exactly what I was looking for.
@wanderingturtle17052 жыл бұрын
Amazing work as always.
@KetraGames2 жыл бұрын
Thank you! 😊
@ZeroChronicles013 жыл бұрын
Omg this is what I've been wanting thank you! I'm also curious about this but in the new input settings for unity? Can this still work?
@KetraGames3 жыл бұрын
Hi, yes you can make this work with the new input system. The rotation part would be the same. You would just need to replace the section where the input is retrieved with the new input system.
@animeeditor51087 ай бұрын
Amazing it help me to make a game! Keep going!
@KetraGames6 ай бұрын
Great to hear, thanks 😊
@megasoniczxx10 ай бұрын
Not sure if you still see the comments for these videos but I wanted to ask if you know how to get it so that when you turn the exact opposite direction (say my character is facing forward and I go immediately back) how would you make it so that the player doesn't slightly shift to the side when this happens? To further illustrate, if I were to keep moving up and down without pressing either right or left my character would be constantly going further along the X axis the more I do this and i'm not sure of the method to prevent this outside of possibly boosting the rotation speed to obscene levels.
@decalibrator34342 жыл бұрын
I love you, thank you for doing these videos!
@KetraGames2 жыл бұрын
Thanks for this comment 😊
@Moon-cr4mu2 жыл бұрын
very helpful tutorial
@KetraGames2 жыл бұрын
Great to hear 😊
@kennethbailey98023 жыл бұрын
you sound a little bit like Adon from Turok 2, thanks for the tutorial!!
@KetraGames3 жыл бұрын
😂 Glad it was useful
@revana94483 жыл бұрын
Thank you so much!
@KetraGames3 жыл бұрын
👍😊
@danielmerki66442 жыл бұрын
Thank you for this helpful instruction and the working script template. Can you maybe help me? I need this function for an enemy that automatically moves to different waypoints. The waypoints are located in a grid. The enemy can drive up, left, right and down. Every time he turns he should change the direction. I am still a beginner and would like to learn it and would be very grateful for your help.
@KetraGames2 жыл бұрын
Hi, you can work out the waypoint from the enemy by subtracting the enemy position from the waypoint position. Then you should be able to use this direction to do the rotation as shown in the video. Hope that helps 😊
@nsr43d2 жыл бұрын
Great Tutorial thank you very much, it`s really helped me.
@KetraGames2 жыл бұрын
Glad it was useful 😊
@kunz41643 жыл бұрын
Glad I discovered this channel. Can you do some 2D related tutorials like Visual novel stuff, or like a map feature where you can click on a place on the map and you can see the player icon move to that location using closest path and then transition to that map?
@KetraGames3 жыл бұрын
Thanks. We'll definitely look to branch out into more 2D tutorials in the future 😊
@felipemeridareinaga3 ай бұрын
amazing video thanks
@KetraGames3 ай бұрын
Thanks for this comment 😊
@abdellatifqassid4687 Жыл бұрын
Thank you so much
@leomenz93 жыл бұрын
thank you so much!!!
@KetraGames3 жыл бұрын
👍😊
@fluturehundozi5102 жыл бұрын
Thank you very much for this tutorial! I was wondering, is there a way to make the object move as soon as the game starts and make it move constantly? I can't seem to figure out that one.
@KetraGames2 жыл бұрын
Hi, I think rather than having the movement driven by the player input you would want to move it at a constant speed in the Update method. Hope that helps 😊
@attrick4433 Жыл бұрын
How would i connect this to a ai pathfinding script that follows the player? I'm new to programming and I'm using the 'Astar pathfinding' scripts.
@KetraGames Жыл бұрын
Hi, this video may help - kzbin.info/www/bejne/jnnViKeCj9mtr5o
@wanderingturtle17052 жыл бұрын
This might be a silly question but what makes Vector3 necessary for the Quaternion as opposed to Vector2?
@KetraGames2 жыл бұрын
Great question. All of the Quaternion methods work for 3D games but you can use them for 2D as well. You can pass in Vector2 values to Vector3 parameters and it will automatically convert the, to a Vector3 with a zero Z value. In this video we used Vector3.forward for one of the parameters as there is no concept of forward in 2D games. You have up and down, and left and right, but no forward and back. For a 2D game, forward is always pointing into the screen, Vector3(0, 0, 1). Instead of Vector3.Forward we could have used transform.Forward and it would have the same result.
@facundoperezsabatini33323 жыл бұрын
thank you so much, this really helped me. But is there any way to also rotate the transform while rotating?
@KetraGames3 жыл бұрын
Hi, do you mean that you always want to move in the direction the character is facing? If so, you can change it so the player input only influences the rotation direction. Then when changing the position use transform.forward as the direction
@tarkerro2 жыл бұрын
When i rotate my pixel art sprites it's distorted if the angle is not a multiple of 90. What am i doing wrong?
@KetraGames2 жыл бұрын
Hi, this can be an issue with pixel art. This article explains the issue - blog.unity.com/technology/pixel-perfect-2d#com There is a Unity package that can help with this though. docs.unity3d.com/Packages/com.unity.2d.pixel-perfect@1.0/manual/index.html Hope that helps you solve the issue 😊
@christiannichols98712 жыл бұрын
@@KetraGames I'm having the same issue. I've installed the pixel perfect asset and read the documentation which shows that if you leave the Upscaled Textures unchecked the pixels will rotate with the image, however when I leave it unchecked and follow the tutorial the image is still distorted. I'm at a loss as to what I need to do to make it work the right way.
@ademademov186111 ай бұрын
What if the starting rotation is not strict, I mean not 0, 90, 180 or 270 degrees?
@pkuuuu Жыл бұрын
It works, but the character keeps facing the top, is it normal? How can I fix it?
@LuckyEcho10 ай бұрын
thanks
@stefankaj442 Жыл бұрын
mine is mixed up when i press down it goes up and rotated wrong way
@TitikUniverse3 жыл бұрын
Господи большое спасибо вам, я делаю игру и хочу сделать поворот летающего корабля в точку Vector2. И я не могу это сделать уже пол года. А теперь я смогу это сделать. Спасибо
@KetraGames3 жыл бұрын
Приятно это слышать. Спасибо за ваш комментарий 😊
@enzilla39738 ай бұрын
does this work with a non-player object?
@blasen_schlampe11082 жыл бұрын
what if I wanted to use only the left and right buttons
@KetraGames2 жыл бұрын
Hi, if you only want to move left and right then you can just leave out the part about the input from the Vertical axis. Hope that helps 😊
@acrow49699 ай бұрын
idk wtf it is im doing but my up and down only go up and my side to side on go down
@thomb.90133 жыл бұрын
i rotate my object, and it suddenly doesnt move correctly.(my movement doesnt use the rotation of the object so it should be unchanged but it isnt)
@KetraGames2 жыл бұрын
Hi, how are you moving the object? Have you tried copying the script from here - dotnetfiddle.net/zyxR2c ?
@nikitafilatov67232 жыл бұрын
thank u so much)) u awesome)))
@KetraGames2 жыл бұрын
Thank you 😊
@ThiagoPrego2 жыл бұрын
Thank you. May the Lord bless you always.
@KetraGames2 жыл бұрын
Thank you 😊
@cr4gdcreator8933 жыл бұрын
Noice
@Montazeran82 жыл бұрын
❤❤❤❤❤❤❤❤❤❤❤❤
@KetraGames2 жыл бұрын
👍😊
@yonosenaipe84902 жыл бұрын
You are GOD
@KetraGames2 жыл бұрын
😂Thank you 😊
@befree93903 жыл бұрын
Here it is using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { [SerializeField] private float speed; [SerializeField] private float rotationSpeed; void Update() { float horizontalInput = Input.GetAxis("Horizontal"); float verticalInput = Input.GetAxis("Vertical"); Vector2 movementDirection = new Vector2(horizontalInput, verticalInput); float inputMagnitude = Mathf.Clamp01(movementDirection.magnitude); movementDirection.Normalize(); transform.Translate(movementDirection * speed * inputMagnitude * Time.deltaTime, Space.World); if (movementDirection != Vector2.zero) { Quaternion toRotation = Quaternion.LookRotation(Vector3.forward, movementDirection); transform.rotation = Quaternion.RotateTowards(transform.rotation, toRotation, rotationSpeed * Time.deltaTime); } } }
@tetelp76563 жыл бұрын
Thank you
@pitchfire79592 жыл бұрын
I had jitter but this fixed it. kzbin.info/www/bejne/sGfTnZyEoZmDfbc
@pitchfire79592 жыл бұрын
I also had a weird glitch where if my player was hit by a game object it would cause my player to move in the opposite direction of the hit, but this fixed that as well.