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 SalmonPunch · Dec 09, 2014 at 01:21 PM · 2dorbit

(Unity2D) having a gameobject "orbit" around another object.

I'm currently learning 2D unity as part of a college game design course. For my project I decided to make what essentially boils down to a Zelda clone since in the process of making it I would be able to learn many of the essentials (Such as AI, Static variable management, saving and loading, etc).

One of the issues I'm having is with one of the enemy types. If any of you ever played the 2D GameBoy Color Zelda games, there is a knight enemy with a ball and chain that sort of "orbits" around him at a fixed radius.

For the life of me I can't seem to reproduce it in code. I've searched around the forums and found fixed orbit code for 3D projects, but so far none for 2D. I tried setting it's pivot point far outside the center of the sprite and altering it's transform.eulerAngles.z, but that just caused it to rotate in place, rather than around it's actual pivot point.

I don't have any code to show since I don't know where to start, but I do have a diagram of the desired effect.

Please ignore the fact that the circle in the diagram below is in fact an oval. It's supposed to be a circle but I'm in kind of a rush.

alt text

Thanks.

unityhelp.png (9.9 kB)
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by screenname_taken · Dec 09, 2014 at 01:23 PM

If nothing else works, you can make the ball a child of an empty gameobject that is at the exact place you want the pivot to be, and rotate that.

Comment
Add comment · Show 3 · 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 SalmonPunch · Dec 10, 2014 at 05:49 PM 0
Share

Rotate the empty object by it's Eulerangles, or via transform.rotate?

avatar image screenname_taken · Dec 10, 2014 at 07:01 PM 0
Share

I'd do it via rotate or an animation cause i'm lazy.

avatar image Serinx · Dec 10, 2014 at 07:09 PM 0
Share

I'm not sure if 2d objects have transforms but if so you could use transform.RotateAround on the ball gameObject and set the point to the Enemy transform.position

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Switching Cameras at runtime 1 Answer

Is it possible to import from unity into blender 1 Answer

Increase Jump Through Mouse Clicks? 1 Answer

A node in a childnode? 1 Answer


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