Monster shadow


How to make a moving character in Unity

Learn the basics of moving objects in Unity as well as a few different approaches to fit your game needs. First, you'll learn how to directly change the transform position of your object. Then I'll show you how to move your character using Unity's physics engine so you can correctly collide with other objects. ========= PlayerController.cs: ❤️ Become a Tarobro on Patreon: ========= 🔔 SUBSCRIBE: 🗨️ DISCORD: ✅ MORE TUTORIALS: 0:00 Intro 0:09 Create the script 0:20 Basic movement explained 0:48 Translate function 2:08 Move using velocity. Collide with objects 2:44 Adding jump using AddForce

I've just created a Discord channel. Come drop in for a chat 😊 it's early days and I'm sure it will undergo many changes, but let's gooooo!
I will get on my laptop then I will join
Gloomy Woods
my biggest issue are controllers... no matter what I change in settings, sensitivity, deadzone, gravity, it's always snappy like GetAxisRaw....So I'm forced to use GetAxisRaw and somehow, magically have to figure out how to smooth this out.... which I couldn't figure out in the last few weeks....
Smoothing can be done by adding some acceleration. So take your input, work out what velocity you'd like to be heading at full speed and then slowly build towards it. You can see how I do this in my ultimate 2d controller script, although it's a bit advanced
Quick question. whats the reason behind underline score behind the name of variables?
@Tarodev Thanks for the explanation. I understand now
I use them for private variables, that way they don't share the same naming convention as local variables. If you can't tell exactly where a variable is coming from by its name, then you need to swap up your conventions 😊 Underscore privates is good c# convention. A lot of official unity devs threw the convention out the window, so unfortunately new devs didn't learn it.
AnImAti0n tAb1e
Thanks for explaining it, this is great!
How to make such beatiful cube and floor?
Marc Dirian
HI and thanks for all your videos !! Anyone can tell me where to get thoses magnifics cubes Tarodev is using ?
Christian Strang
Great tutorials! Could you create one where you show how to setup your scene? I have the hardest time to make a scene look great in 3d and I like your setup a lot (textures you use, lighting, small particle effect), would really appreciate it!
Vskutku Trigen
we change velocity, Should not that be in Fixed update ? And also we dont need delta time when changing velocity ?
Nope, setting velocity directly does not require Fixed Update. We don't need delta time as we're setting the value to a specific number and not ADDING a value to the current number. Hope that makes sense!
Baris Dincer
I just discovered your channel and videos. Good job there! One question about this video though. Wouldn't it be better if you used FixedUpdate method instead of Update, when you're dealing with physics?
As a rule, you're right and it's generally better. For example if we were adding force it's better to place it in FixedUpdate (although that's what multiplying by Time.DeltaTime allocates for). For this scenario where we are setting the velocity directly there shouldn't be a difference either way. But generally, yes.
Sarthak __Rgv
hey could you tell me how can i make a cube roll on a grid such that a cube of length width and height of 1 unit would roll onto a grid of 1 unit length and width(like a chess board) and be perfectly centered on the next adjacent grid tile it has been rolled to. Hope i'm clear?
Here, I just made a video about it:
Nice! Could you make a tutorial about how to set the camera and post-processing that you used for this tutorial. Thanks!! :)
X-Tech Gaming
i just came across your channel and seems u have amazing detailed stuff. I wanted to know how to make a game manager, but I wish if u do a detailed longer video on how to make all of managers scripts/event and and when and how to use them
Pulkit Dubey
also please make a video about character controller
Pulkit Dubey
love you i wasn't able to understand a thing before and i was going to quit unity thanks to u !!
Awesome. Glad you didn't quit unity 😊
Sir Plum
thanks ill try this out later
Great stuff! Very concise and to the point and super well explained. Looking forward to more content!
Hello, you don't know how to do this:
Raoul Best
Amazing video! The quality is the thing that makes it shine, especially that great atmosphere and not a blank unity scene. Hopefully people who need will find this channel.
Thanks Raoul! I like to try provide a feast for your eyes as well as your brain 😊
Very good, good luck, man 👍👍👍
Amazing video!


stick around and i'll show you a few ways to get your character or an object
moving around in your game let's get stuck into it
to start create a new c-sharp script and call it
player controller now attach it directly to your player
object to show you the basics let's use this
code inside your update function create an if statement checking if the
player presses w on the keyboard if so move the player one unit forward
vector3 forward is shorthand for new vector3001
now in the editor press play and then w on your keyboard
your character should move one world unit on the z-axis
but this is a bit boring so let's continue
let's alter the code first add a serialized float called speed so that we
can adjust it in the editor next we need to gather player input to
determine which direction to move we create a new vector3 called der and
we set x to input.getaccess horizontal
0 for y and input.getaxis vertical for z this uses the built-in unity input
manager ensure you spell these exactly right or
they won't work as expected next we reference our object transform
and use the built-in function translate fade in the direction we just gathered
multiply it by our spade variable and then to ensure we have a balanced
experience across multiple devices and frame rates
multiply it once more by time dot delta time
press play in the editor and use the wasd keys or the arrow keys to move your
character around you'll notice it's very slow let's pump
the speed up a bit using the speed float we exposed in the script
awesome a downside to using translate is that it directly manipulates the
transform position of the object which means you will push right through
other colliders this may or may not be a problem for your game
but keep watching and i'll show you how to move around using unity's physics
engine so that we can collide with objects as
we'd expect add a reference to the player's rigid
body we'll collect the direction the same as before
but instead of using translator to set the position directly we'll instead set
the rigid body's velocity in the editor add a rigid body to your
player object freeze the rotation on all axis and set
interpolate to interpolate to provide a smoother experience
also ensure you have a collider attached as you can see
the plane now collides properly as well as starting and stopping
with a bit more realism if you really want to make this a party let's add a
rudimentary jump to our character first add a new serialized float called
jump force we need to change the way we gather
player directional input to ensure we're not messing with our jump velocity
grab our input and multiply it by our speed variable
next let's set our y velocity to whatever it's currently sitting at
which will change when we jump set our rigidbody's velocity to this new value
to get jump working check if the user presses space flow and if so
add force to the rigid body fit in up as the direction
and multiply it by our jump force press play
and smash the space bar to make your player jump
heck yeah before you leave subscribe to my channel for more tasty tutorials
and good luck with your game development journey