Рет қаралды 875
How do you change the pivot point of an object in Unity?
If you add a new 2D object to the scene, a problem that you might have every time is that you cannot modify the pivot point in the way you would like. Instead of having a pivot point positioned in the center, and your object is positioned above, you will face this issue. To fix that, you need to do this:
Create an empty parent object and add a box collider. Make sure to move the triangle object above the center. Now you should add a box collider 2D. If the empty parent has a box collider, that will make sure that the child object is on a different position and will be rotating around the parent object.
An easy way to make the object rotate is by adding a simple C# script:
Add a public float variable that will be called Speed. This value will be used in determining how fast will the object move. To make the object rotate around the center, you need to add a transform.Rotate() line of code.
It will be cool to make a space shooter with this triangle! But that will be explained in the next video.
The point of this tutorial is in rotating the parent object, not the object that is inside it. This video is not part of the 2D platformer series, it belongs to a specific section of Unity tutorials that will only cover some elementary things.
Support the Creator of Kozmobot on the social networks!
CHECK OUT MY WEBSITE: kozmobot.com
INSTAGRAM: / kozmobot.channel
TIKTOK: / kozmobot.channel