3D Platformer in Unity – Player Rotation

3D Platformer Rotation

The easiest guide to make a 3D platformer rotation script in C#, this video will help you understand the basics of Unity game development.

In this video, I will teach you how to make a 3D platformer in Unity. It is a super easy-to-follow video that will show you everything you need for a stunning look rotation in Unity.

The problem that most developers have is that the look rotation returns back to 0 (Y-angle) and they weren’t able to figure out. This video, however, was able to find the adequate solution for look rotation and keeping the direction of player after releasing arrow keys.

For that reason, I present to you a slightly different video, that will cover the basics of player rotation. It will make your player move and change orientation without returning to its original look rotation. This video is also a perfect entry for the future of 3D game development. This video will help you make a small game scene that controls a capsule character. As you can probably realize, the player rotation refers to running in different directions. That is the topic this video is about.


Click the video to watch.

Creation Guide

The creation of the script is explained with these photos:

1. Freeze rotation

The first step is to avoid making your cube fall down. The rigidbody is not recommended for a game character, it is a physics material for other shapes. For that reason your object can tumble and wobble, making it impossible to move in any direction. You can fix it by freezing rotation, described at the picture 2. The game also needs to have some more interesting elements: player rotation and rotation speed.

2. Rotation speed

The rotation speed is usually a float variable. Its value is optional, you can try 360, 480 or 720. It defines the speed of changing player’s orientation. In the line of code that says transform.Translate you should add just one more thing: Space.World, which defines the relative space of your player.

3. Define look rotation

Avoid making your player revert to its original look rotation by defining this statement:
if(moveDirection != Vector3.zero) because if the player’s movement direction isn’t equal to the zero vector, it should be able to rotate and keep rotation angle after releasing the arrow key.

4. Test your game

Simply test it and play with the game variables. The part of the video where Creator puts a cube onto the capsule is not present in the video, because it is optional, you can add anything you want.

Conclusion

Unity Game Courses is a section of videos that explain the process of game creation. It only focuses on Unity game engine, which is the next big thing on Kozmobot. This website will focus on making game dev tutorials that will be useful for beginners and intermediate users.

Share this website with other developers and they will be able to make their games. The game industry has a lot of stable revenues and every such step is explained in the Ins and Outs post. Any discussion will be strongly appreciated.


Leave a Reply

Your email address will not be published. Required fields are marked *