Me and My OC Part 3 - Character Movement 1
- Mervin Ko Han Wei
- May 22, 2021
- 2 min read
Hey everyone, Mervin from Golden Monkey Studios here. Today, we’ll be continuing our tutorial on making your own OC asset. Today, we’re doing the first part of character movement for our robot!
The first thing we need to do after importing the assets to Unity (by dragging the fbx and texture files inside the inspector window) is to unpack the prefab as we need to group the head in a empty GameObject.

To start with movement , we create a script for the model called CharacterScript. We then create a variable called MoveSpeed (using the public access modifier because we want to be able to change the speed in the inspector easily). In the Start function, we need to multiply the speed with Time.deltaTime to allow the character to move at a constant speed regardless of the different time between frames. (Edit: please edit your MoveSpeed in the Update function!)

To accept our inputs, we need to test for them in the Update function. For forwards and backwards motion, we'll be moving along the object's local z-axis (+ for forwards, - for backwards). For left and right motion, the local x-axis (+ for rightwards, - for leftwards).
Now that you are done with the movement, you can press run and test your inputs.

Next up, head rotation. First we put a public transform for the head, camera to reference the camera and float RotationSpeed for the speed. In this RotateHead function, we'll then test for mouse input along the x-axis. If there is, we'll set newY to be however much the mouse has moved along the x-axis times the RotationSpeed times Time.deltaTime (to ensure no FPS bias). Then, we'll add this rotation onto the object's rotation, hence updating it to the new rotation.
Now, you should be able to run and test your rotation!
I hope that this tutorial has been beneficial, remember to check out Part 4 of the tutorial for animating the sphere and jumping!
Comments