• 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 BlazingRiver · Sep 03, 2013 at 10:59 AM · orbitbasic programming

How to Make a Ship and it's Projectiles Orbit a Planet? (Like in Super Stardust)

Hi,

I am looking to make a game similar to that of super stardust -- like this

http://www.youtube.com/watch?v=Jhhocl7jf3o

It is basically a game where the player, camera, enemies/asteroids and projectiles are orbiting a planet around a certain radius from its centre point. The player has to destroy the enemies/asteroids by shooting them while all the shots curve along with the planet.

I have created the planet and the player using this asset, but what i am having trouble doing is making the player, camera, enemies/asteroids and projectiles orbit the planet.

I am using this asset for constructing the scene (if its any help) Space Unity

I am fairly new to programming and i am still learning, but any help would be appreciated :) I am also using playmaker (if its possible to create the orbit with playmaker)

Thanks :)

Screenshot about what i am trying to achieve: http://i.imgur.com/AQDQeS8.jpg

Comment
Add comment · Show 1
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 fafase · Sep 03, 2013 at 04:03 PM 0
Share

That could help you starting http://unitygems.com/basic-ai-space-shooter/#Ellipse

2 Replies

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

Answer by Fattie · Sep 03, 2013 at 01:12 PM

an extremely simple way to do this is:

you have the planet P.

just add an empty transform, called "spinner" at the same point.

Sit your satellite "S" in "spinner"

Now, move the "S" "outwards" until it is say 20 km from the planet (or however far you want)

Now ............. just rotate "spinner"

It's just that easy.

You can then more "S" in and out ("up and down form the planet") trivially and it will maintain it's clean orbit.

It's a great example of the unbelievable power of the transforms and parenting concept in game engines.

Comment
Add comment · Show 8 · 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 oferei · Sep 03, 2013 at 02:45 PM 0
Share

that's a simple solution for fixed orbit (which is what the OP asked). but I should mention that you may want different spinners for different satellites, so they can move independently.

avatar image Fattie · Sep 03, 2013 at 03:45 PM 0
Share

right, each "satellite" has it's own spinner for sure

avatar image BlazingRiver · Sep 15, 2013 at 03:50 PM 1
Share

Sorry, i don't really understand what you mean by sit your satellite in the spinner and rotating the spinner. Does it mean make the satellite a child object of the spinner? Would this make it so it would be in a fixed orbit where the bottom side of the space ship always faces the planet?

avatar image Fattie · Sep 15, 2013 at 03:55 PM 0
Share

"Does it mean make the satellite a child object of the spinner"

Exactly

"bottom side ..."

exactly

It is a very common, basic technique in vid games, enjoy!

avatar image oferei · Sep 15, 2013 at 03:59 PM 0
Share

yes, the so called "spinner" is just a term given to some empty game object which should be located at the center of gravity. any child object(s) you attach to it will orbit when the spinner is rotated.

Show more comments
avatar image
0

Answer by oferei · Sep 03, 2013 at 12:49 PM

Unity does not support this out of the box. You'll need to disable the built-in gravity (in settings or code) and code the planetary gravity yourself.

Perhaps this answer might help you.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

18 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 avatar image avatar image avatar image

Related Questions

Why when I hit play the game is paused? 1 Answer

Unity reboots my computer 1 Answer

Player model doesn't stay on ground 1 Answer

Help Needed With Object. 0 Answers

Help! My respawn script isn't working! (Answered) 4 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