Rotating in World Space- Game Dev Series 141

S.J. Jason Liu
Oct 23, 2021

Quick guide of rotate an object in world space of Unity.

When rotate an object in Unity, we usually use transform.Rotate(). In this quick tip, I would demonstrate how to rotate an object in world space.

Rotating object

In this tutorial, I would make a box of pistol ammo rotating in the air.

To rotate an object, using transform.Rotate() in Update().

Inside transform.Rotate(), we need to assign which axis that we would like to rotate. Then multiply it to deltaTime.

So far, this would be the basic way to rotate an object in Local space.

World space

It would be very simple to rotate in world space. We simply add another parameter.

Add another parameter to it: Space.World.

That should make your object rotate in world space, just like my pistol ammo.

--

--

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.