Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by TheSoloPlayer · Nov 06, 2016 at 09:05 PM · unity 53dforcerocketconstantforce

How do I make a rocket?

I'm trying to create a rocket, where you would press the space bar, and hold it to keep going up, and you could use wasd to control which way the rocket faces. How would I create a rocket like this? I had looked at a video of how to do it with constant force, but for some reason Unity came up with an error that "constantForce" was obsolete. I found that strange especially since it was a component that I could add to the rocket itself. Any help?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Developer1212 · Nov 06, 2016 at 09:46 PM

You can use the AddForce () function instead of the constant force function.

Comment
Add comment · Show 2 · 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 Makri907 · Nov 06, 2016 at 10:33 PM 0
Share

Rigidbody.AddForce() only applies force for one frame and returns to zero. Constant force is constantly applying force and only changes when the force or torque value is changed.

avatar image Developer1212 · Nov 06, 2016 at 10:37 PM 1
Share

Not if you use it like this:

 if (Input.Get$$anonymous$$ey($$anonymous$$eyCode.Space)) {
 rigidbody.AddForce (Vector3.something * Time.deltaTime);
 }
avatar image
0

Answer by Makri907 · Nov 06, 2016 at 10:28 PM

IMPORTANT: Be sure to add a Constant Force Component to your rocket. Create a C# script on your rocket and attach this to it:

     ConstantForce thrust;
             public Vector3 rocketDirection;
             Vector3 copy;
             public float xlrate;
             void Start () {
                 thrust = gameObject.GetComponent<ConstantForce> ();
                 copy = rocketDirection;
             }
             
             void Update () {
                 if (xlrate >= 20f) {
                     xlrate += .025f;
                 }
                 if (Input.GetKey (KeyCode.Space)) {
 thrust.force = rocketDirection * xlrate;
                     rocketDirection = copy;
                 }
                 if (Input.GetKeyUp (KeyCode.Space)) {
 thrust.force = rocketDirection * xlrate;
                     rocketDirection = Vector3.zero;
                 }
             }
         }

Note: Set the xlrate to something reasonable like 2 or 3. And for the Y position on rocketDirection, somewhere between 10 and 20.

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

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

Related Questions

Rocket Landing 1 Answer

Convert 2d object in 3d 1 Answer

I'm having a few issues with (Catmull)Splines that i need help with. 1 Answer

How can I make a game similar to Lego Universe (sort of like a replica) 0 Answers

How can I add a shader to an entire environment? 0 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