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 ejones · Jan 12, 2012 at 11:18 PM · movementphysicsball

Simple 2D smooth ball movement

I am working on a very simple, but tricky thing:

I want to move a ball across the screen in a smooth way (in 2D space).

Unfortunately whatever approach I make, I always experience jitter. I am currently evaluating it with the editor Gameview running constantly at 60fps.

Aproach #1)
Apply a Rigidbody to the ball Mass 0.01
Drag 0
Angular Drag 0
Gravity off
Interpolate Interpolate
Collision Detection Continous
Contraints:
Freeze Position Z
Freeze Rotation X,Y,Z

Starting Movement with:
rigidbody.AddRelativeForce(new Vector3(0, 30, 0));

Does not look very bad, but its not a smooth animation

Approach #2)
Without rigidbody
Vector3 velocity = new Vector3 (0,30,0);
void FixedUpdate()
{ Vector3 velocityComponent = velocity * Time.fixedDeltaTime; transform.position = transform.position + velocityComponent; }

still no good results

Comment
Add comment · Show 2
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 Fattie · Jan 13, 2012 at 09:48 AM 0
Share

For the record -- when you experience Jitter, very often it has something to do with the fact that you're using Update rather than FixedUpdate (or vice versa) in the wrong situation. You should also be careful about what your camera is doing, if it's not just fixed.

avatar image ejones · Jan 13, 2012 at 02:49 PM 0
Share

Thx for the note. I had also tried the Update() function with Time.deltaTime and could not see a difference.

The camera is fixed in my setup.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Berenger · Jan 13, 2012 at 01:56 AM

Take a look at Vector3.SmoothDamp. And if you really need a rigidbody, you should toggle Kinematic in rigidbodies' parameters.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

The ball is stuck in the beginning position 1 Answer

How to create icy floor? c# 1 Answer

Ball Rolling System 1 Answer

Simulating the graphics of a rolling 3D ball in a 2D game 2 Answers

Constraining maximum movement speed on a rigidbody on certain axes. 1 Answer


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