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
1
Question by ramonfr · Aug 09, 2012 at 01:00 AM · rigidbodymultiplayernetwork

Rigidbody.AddForce depending on frame rate?

I got a big problem with my multiplayer game.

The players are able to kick (pressing the mouse button) in order to apply a force to the ball (rigidbody, networkview). The ball position is being networked without problems.

But I realized that depending on the FPS of the client, the force applied to the ball is higher or lower. For clients running the build under a low FPS rate, the force applied to the rigidbody is much higher than the force applied by a client running the build under a higher FPS.

In the script the impulse is made this way: rigidbody.AddForce(destiny force Time.deltaTime, ForceMode.Impulse).

Here's the build: golonline.net/play.html

Inside the game, go to Play -> Training and create a server. Try kicking (with the left mouse button) and see the result. Then try droping down the FPS somehow and repeating the process. You'll see the kick stronger at low frame rate and strong at high frame rates.

How can I solve it?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by aldonaletto · Aug 09, 2012 at 01:16 AM

You should remove Time.deltaTime: if that line of code is inside Update, LateUpdate or a coroutine, the force will be inversely proportional to the frame rate. AddForce usually is frame rate independent: ForceMode.Force applies the force during one physics cycle (20mS per default), while ForceMode.Impulse "kind of" applies the force during one second (it actually concentrates the effects of one second of continuous force in a single physics cycle)
If you remove Time.deltaTime and change the mode to ForceMode.Force, things probably will behave ok without having to alter force too much.

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 Kryptos · Aug 09, 2012 at 07:58 AM 0
Share

And consider doing it in FixedUpdate ins$$anonymous$$d of Update (or using WaitForFixedUpdate in coroutine).

avatar image awsapps · Oct 21, 2021 at 05:43 PM 0
Share

Is this true? I have a button listener that, on click, applies some impulse to a rigid body. If the FPS are lower, the impulse is a looot more strong...

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

10 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

Related Questions

NetworkView Control 2 Answers

Multiplayer Physics Extrapolation 1 Answer

Network particle collision 1 Answer

Optimize iPad multiplayer? 1 Answer

Testing my multiplayer character offline 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