Dagger
Dagger

Reputation: 9

Unity2D: How to rotate arm with mouse

i am currently working on a 2D project, i want to rotate an arm on my character, the arm is indeed a separate sprite, from the body of the player.

I have a working script the rotate the arm perfectly but, the whole arm is rotating around a point in the middle of the arm, i want to rotate the arm from the shoulder, any ideas on how to do that?

Upvotes: 0

Views: 120

Answers (1)

Mark Lorenz
Mark Lorenz

Reputation: 56

The pivot point of your sprite is set to center rather than the end where the shoulder is located. You can use the sprite editor to change the pivot. Below is a quick step by step on editing the pivot. You can also find the information here -> https://docs.unity3d.com/Manual/SpriteEditor.html

Editing Pivot on a Sprite

  • Select the 2D image you want to edit from the Project View. Note that you cannot edit a Sprite by selecting it in the Scene View.
  • Click on the Sprite Editor button in the Texture Import Inspector and the Sprite Editor displays
  • Select the pivot drop down and select a your pivot location.

enter image description here

Upvotes: 1

Related Questions