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 e-bonneville · Jun 05, 2010 at 01:19 PM · physicsasteroids

How would I do Asteroids style moving?

Hi, I'm working on an Asteroids game, and I can't figure out how I would do Asteroids style moving. I'm going for the classic Asteroids effect where, after speeding up, you don't slow down until you press the opposite key. How would I do that?

Thanks, Elliot B.

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

3 Replies

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

Answer by Eric5h5 · Jun 05, 2010 at 04:56 PM

Use the physics engine, where you have an object with a rigidbody and this script:

var rotateSpeed = 360.0; var thrustSpeed = 25.0;

function FixedUpdate() { transform.Rotate (Vector3.up (Input.GetAxis("Horizontal") rotateSpeed * Time.deltaTime) );

if (Input.GetButton("Thrust") ) { rigidbody.AddRelativeForce (Vector3.forward thrustSpeed Time.deltaTime); } }

You can use drag to limit speed, because in Asteroids you do actually slow down over time. If you don't want that, then you have to limit speed some other way (check rigidbody.velocity maybe).

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 e-bonneville · Jun 05, 2010 at 10:13 PM 0
Share

@Eric5h5 Perfect, thanks a lot. ;)

avatar image
-2

Answer by Tobias · Jun 05, 2010 at 01:36 PM

You should make a var speed.

While you hold down the movment key you should increase this var (Until max speed is reached).

Now do a loop where you transform your charakter + speed.

And ofcourse when you press the oposite key decrease the var speed Hope you understand what I mean.

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 Potapczuk · Jun 05, 2010 at 07:16 PM

Check this little Asteroid game that i made with Unity for study purposes:

http://www.diegoliveira.com.br/asteroids/index.htm

It may help with some ideas.

Btw, it is not completed.

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

No one has followed this question yet.

Related Questions

Asteroid 2.5D : Asteroid Physics 1 Answer

Rigidbody making object rotate despite locks 1 Answer

Lag on Physics when Spawn meteorites 0 Answers

2D 360 degress platformer example needed 0 Answers

Rigidbody sticks to walls. Or, how the h*ll do you force elastic collisions? 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