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 NPstudio · Sep 25, 2013 at 10:27 PM · accelerometerpitchunitysteer

Gradual Acceleration?

Hello, and thank you in advance for your help I am making a game that uses lots of the plane mechanics But thr code provided to me only half works it has a constant speed either going up or down

can anyome help me getting a gravity-like feeling of an acceleration while pointing down and/or up(stalling)?

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 robertbu · Sep 26, 2013 at 12:52 AM 0
Share

I like to use a velocity model. For a falling object, you can do:

 velocity.y += gravity * Time.deltaTime;

1 Reply

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

Answer by darthbator · Sep 25, 2013 at 10:56 PM

You would want to do something like (this is a really lame example but hopefully you get the idea).

 transform.Translate(transform.forward * speed * Time.deltaTime);
 speed += Time.deltaTime * speedMod;

This way with each frame (or run of this code if you use a coroutine or other bounding factor) the speed that the object is moving at is increasing with each frame.

If you want to reduce the speed of motion you simple reduce the value of speed. Which can either be done gradually kind of like adding to it.

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 NPstudio · Sep 25, 2013 at 11:03 PM 0
Share

I would like to try this but before doing it i'm afraid that this will (hopefully) work in EVERY direction, while i'm looking for a way to simulate gravity (while going down) and stalling (when going up), would it be possible to implement in the code something that reads the Y axis and behave in that way? Sorry for the bother

avatar image darthbator · Sep 25, 2013 at 11:26 PM 0
Share

Yes this will work with any float in the vector. I simply used forward as an example.

avatar image NPstudio · Sep 26, 2013 at 10:41 PM 0
Share

darthbator i hope you can help me once again with this.

here is the code i'm using right now

 #pragma strict
 
 var speed : float;
 var speed$$anonymous$$od : float;
 
 function Start () {
 
 }
 
 function Update () {
         if(Input.GetButton("run"))
             transform.Translate(transform.forward * speed * Time.deltaTime); 
             speed += Time.deltaTime * speed$$anonymous$$od;
 }

I implemented the "run" input just to test the movement of it.

the problem with this is that there is no smooth transition from the initial speed to the upgraded one, it goes from 1 to 100 in one frame for some reason

while another problem is that i personally do not yet understand how Vector3 works at all, i cannot get it to work because it's supposed to go faster when facing down, but slower when reaching a certain point of height

can you help me with that?

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

16 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

Related Questions

How do I calibrate my games's pitch (0,0) position on android accelerometer? 0 Answers

UnitySteer - any way of determining when you've arrived at a node? 1 Answer

using cohesion but keeping minimum distance apart with unitysteer 0 Answers

Need Help for aeroplane scrip 1 Answer

Proximity Detection Code not working 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