Jagged rotation

How to make a cube in the tutorial rotate like the animation in the old console video-games? I mean not the smooth rotation but a more junky rotation?

Hi, I haven’t tested the following code, but it should work or at least give an idea.

    public float rotationStep = 15f;
    public Vector3 rotationAxis = Vector3.up; // Adjust this for desired rotation axis

    private float currentRotation = 0f;

    void Update()
    {
        // Check for input (e.g., button press, timer, etc.) to trigger rotation
        if (Input.GetKeyDown(KeyCode.Space)) // Replace with your desired input condition
        {
            currentRotation += rotationStep;
            transform.Rotate(rotationAxis, rotationStep, Space.World);
        }
    }
1 Like

Thank you, Mr. Games, interesting idea! But what if I want to make all motions like that… I thought maybe some-how change the frame rate of game-updates, or somethings…

Hello, I think that changing the frame rate or similar methods will only cause problems later. Unless you have millions of different objects that need to be rotated this way, I think the code I sent earlier is the best option. You can also create a rotation speed variable that all objects access so you can change the speed later…
Maybe describe your project further, so I can understand better, what you want to achieve.

It is tutorial from Unity Essentials in-build learning stuff… My project will be 2D arcade, a simple video-game like the old video-games, but I do not need ‘smoothness’ of motions in my future projects, the world of my future video-game should look like this.
Evolution of Contra w/ Facts 1987-2022

If you want to have everything without this smoothness, then you could use
Application.targetFrameRate = 10; // Or some other small value
The problem would be that the UI and everything else would also operate at this frame rate. This makes it very “delayed”. If that’s what you want to achieve then that’s perfect, but it brings these problems.