Rotate an object around a different Pivot

Hi

i am creating a Top 2D car chasing game , and i want my car to rotate around The Z axis when i click Right / Left arrows

i can do that easily using eulerAngles
csharp** **transform.eulerAngles = (new Vector3(0, 0, Rot));** **

But i want the car to rotate around a Pivot that is a bit below down the center of the car. I don’t understand how softwares like GameMaker and Buildbox make it super easy to move the rotation pivot of a given sprite, while Unity doesn’t … anyway … ( i hope Unity Team read this Thread )

is there a way other than making an empty object as a parent of the car, place it whenever i want , and than rotate it ( and the car rotate with it ) ?

by the way , even the parenting solution don’t seem to work for me. Maybe you can help on this, still a beginner.
Ps : i want to make the car rotate Like in the picture where it say YES

Thanks in advance :slight_smile:

Let’s make this thread a definetive solution for anyone trying to solve the Pivot issue with Unity 2D

@expandable

So what is wrong with the obvious solution i.e. parent your sprite under a transform and rotate it - like you said?

If the rotation doesn’t look natural, it’s a different matter.

Real four wheel vehicles usually steer with front wheels so the pivot placement and arc you create while turning must match actual movement path one would expect pretty close, otherwise you end up with sliding look. Of course you could use actual car rig instead of faking it.

1 Like

@expandable

You could also make your vehicle sprite have a pivot as child and use it as rotation origin. This way you can move it forwards and backwards depending on effect you want, and your car will rotate around this point:

car.transform.RotateAround(pivot.position, Vector3.forward, turnSpeed * Time.deltaTime);
4 Likes