Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by DoubleATam · Feb 08, 2015 at 01:40 AM · 2dspriterotate

Rotate a 2D sprite without rotating the transform

Oddly I find a lot of answers for the opposite problem, but in this case I'd like to rotate the 2D sprite without changing the collision.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

5 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by TargonStudios · Feb 08, 2015 at 03:32 AM

You want to rotate the sprite, without rotating it's collider? If so, you could just create an empty gameobject, put the collider on it, and make the sprite a child of it. The sprite could rotate all it wants, and the collider would remain on the parent object, not moving.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by unity_VAdh9YNt55SvQA · Dec 04, 2019 at 12:39 PM

@ozcomingfroo_unity In the sprite properties, there is check-box for vertical flip. It flips picture, not game object itself. notice: 180° rotation = vertical filp + horizontal flip

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by Rohit-M · Feb 08, 2015 at 03:34 AM

If you'd just like to have the collider not change, you could try:

1) Create an empty game object

2) Add a collider component to the game object (the same collider that you'd use for the sprite)

3) Delete the collider component from the game object that has your sprite

4) Parent the sprite game object to your collider game object (So the sprite is the child)

Now if you rotate the sprite's transform, the collider won't rotate (because it's on a separate object). If you move the collider, the sprite will move with it.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image DoubleATam · Feb 08, 2015 at 03:56 PM 0
Share

I expected there to be a simpler way, considering this seems to happen on accident to some. It might just be my bad guess, but isn't using multiple game objects somewhat inefficient?

avatar image TargonStudios · Feb 08, 2015 at 07:32 PM 0
Share

The very fact that you're using sprites makes me assume the game is 2-D. So you're probably not going to have to worry about being "inefficient" (depending on what you're doing). Even if so, an empty game object will do little to nothing.

avatar image DoubleATam · Feb 09, 2015 at 12:55 AM 0
Share

I don't think you can ever optimize too much. If an empty Game Object is really that impact-less, I might consider it, but I'm just surprised I haven't heard a different method.

avatar image TargonStudios · Feb 09, 2015 at 01:00 AM 0
Share

Honestly, it seems like making the script(Or what ever it is) to keep the collider from rotating, while allowing the texture to rotate would take more work (plus being less efficient) than to just add a parent. It's probably the best choice.

avatar image
0

Answer by ozcomingfroo_unity · May 24, 2019 at 12:28 PM

The answer was already given but I'll give my own anyway. I searched for this issue and the answer was not what I was exactly looking for ,I.E. in my case anyway.

I currently build a classic space-shooter and I made some enemy space ship sprites. The the sprites have the enemy looking "up" which is the opposite direction of the player that is position at the bottom.

Since I only need to change rotation of the sprite itself, I thought maybe Unity had the tools to do some basic editing to the sprites such as rotating the image itself and replace the old with the new. No such feature was found in my case, which is why I resorted to use a simple image editor.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by unity_VAdh9YNt55SvQA · Dec 05, 2019 at 09:57 AM

@ozcomingfroo_unity In the sprite properties, there is check-box for vertical flip. It flips picture, not game object itself. notice: 180° rotation = vertical filp + horizontal flip

,is not there check-box for vertical flip in sprite properties ? I have not editor juset here, but i im sure, this option was there.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

[2D] How do you rotate a 2D sprite left and right with C#? 2 Answers

Finding the centre of two touches 2 Answers

Quaternion Rotate Towards Y Value 1 Answer

Sprite "face" second sprite only on Z axis 2 Answers

2D lock x,y rotation to look at target 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges