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
0
Question by $$anonymous$$ · Jul 21, 2013 at 04:15 PM · c#rotationmouserotatearound

How to rotate an object around another facing to mouse?

Im making a 2D game and i need to make a pointer that rotates around a plane and points to mouse. How can i do it? Thanks. Look at geometry wars :http://www.youtube.com/watch?v=u83rxKmzu6E , ship has triange that rotates around ship and points to mouse. How can i do this?

 public Transform ship;
 
 void Update() 
 {    
    transform.RotateAround(ship,30);        
 }

alt text

бе3psd.png (48.9 kB)
Comment
Add comment · Show 4
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 cdrandin · Jul 21, 2013 at 05:24 PM 0
Share

Could you at least explain in more detail what you want?

avatar image robertbu · Jul 21, 2013 at 06:13 PM 0
Share

As @cdrandin indicated, a much better description is needed. A drawing or a screen shot would also be very helpful. There are multiple different ways to interpret your question.

avatar image manu3d · Jul 21, 2013 at 08:43 PM 0
Share

Indeed there are a variety of possible interpretations to your question. I.e. you write about planes but I wonder if they are those of the mathematical or the flying variety!

If it's the latter, are you perhaps asking how to create a target-like pointer that sticks to the (air)plane, to highlight it, and has a second element that somehow visually connects this target to the mouse pointer?

avatar image $$anonymous$$ · Jul 22, 2013 at 09:38 AM 0
Share

Added screen, that triangle rotating around ship and points to mouse.

1 Reply

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

Answer by robertbu · Jul 22, 2013 at 02:16 PM

There are a number of posts with different solutions on getting a 2D object to follow the mouse. Here is one:

http://answers.unity3d.com/questions/411419/rotationy-flips-when-turning-around-x-axis.html

You can handle the rotate around part in a couple of ways. First, you could make your texture large enough to overlay the underlying ship like this:

alt text

Where the blue is the boundary of the image. Everything but the arrow is transparent. So when this image is centered on the ship, the arrow would be at the boundary of the ship.

The second solution would be place an empty game object at the center of the ship. The arrow would be a child at the correct position. The rotation code goes on the empty game object.


arrow.png (3.6 kB)
Comment
Add comment · Show 1 · 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 $$anonymous$$ · Jul 22, 2013 at 03:20 PM 0
Share

Thanks for idea with square :)

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

15 People are following this question.

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

Related Questions

Multiple Cars not working 1 Answer

Flip over an object (smooth transition) 3 Answers

Rotating object with a mouse movement 0 Answers

How to rotate Character on Y axis along with the mouse rotation? 0 Answers

Distribute terrain in zones 3 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