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 SUPPEAR · Feb 06, 2015 at 10:19 PM · androidmobilegameobjects

RigidBody2D Constant Velocity?

Hello, I am making a game where you have to avoid falling blocks. The game is 2D and the objects are squared. The objects seem to fall perfectly fine using Gravity, but the blocks that spawn higher up gain too much speed falling down which ends up making my game near impossible. I have tried searching for other posts but none seem to work for me. All help is appreciated.

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 Owen-Reynolds · Feb 06, 2015 at 10:46 PM 0
Share

Did you try a search on "unity limit rigidbody speed"? The first thing that came up is the way I do it.

You say that none work for you? Which ones? $$anonymous$$aybe you're just missing one thing.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by DanSuperGP · Feb 06, 2015 at 10:39 PM

Gravity works like... gravity.

That is, it's an acceleration, 9.8 meters per second, per second.

So, if you want your falling blocks to travel at a constant velocity instead of accelerate, you will need to turn gravity off, and then set a velocity for the rigid body.

You can set the velocity of a rigidbody directly.

http://docs.unity3d.com/ScriptReference/Rigidbody2D-velocity.html

Of course, if you have drag (and you should have some) and you set their velocity once, they will slow down.

But you could just set the velocity every frame in Update.

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 lienadnellum · Feb 07, 2015 at 02:27 AM

Hi I had the same problem. The speed at which it falls is velocity I believe.this is how to access the speed at which it falls "rigidbody2D.velocity.y" so this might help.Just make this a Java Script attach it to a block give it physics 2d set all the values on the component to zero,on the script ,Set max falling speed to the fastest you want the block to fall, set the falling speed increase to how fast you want it to gain speed.

/*"var Velocity : Vector2;// helps for debugging

var MaxFallingSpeed : float = -10;

var FallingSpeedIncrease : float = .1;//how fast to make the object fall faster.

function Start () {

 GravityEffect();


} function GravityEffect () {

var i = 1;

    for(i=1;i>0;i++){

    yield WaitForSeconds(FallingSpeedIncrease);
         
        if(rigidbody2D.velocity.y > MaxFallingSpeed){
        rigidbody2D.velocity.y -= .1;
         }
 
    }


}

function Update () {

 Velocity = rigidbody2D.velocity; //this will give the velocity in the y and x values constantly

}"*/

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 SUPPEAR · Feb 06, 2015 at 11:12 PM

I just ended up with deciding to put an angular drag on. When I said it didn't work for me, I meant it as in the objects went through the objects. Thanks for the response though :)

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

21 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

Related Questions

Destroy Object On Touch? 2D 1 Answer

Destroy Object On Touch? 4 Answers

big terrain performance && mobile 1 Answer

Touches not registering in android? 0 Answers

iOS and Android Publishing 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