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 /
avatar image
0
Question by ungalyant2 · Sep 19, 2011 at 03:13 AM · velocitydragcontrollersmassrigidbodies

Problems with rigidbodies

In an attempt to lower the lag caused by having many enemies on screen at once, I changed my enemies to be controlled with rigidbodies rather than character controllers. I believe these are less intensive on computations but I'm not sure if this is the case, so if someone could tell me the answer to that that'd be great. But primarily, I'm dealing with the problem, that despite affecting the velocity of the rigidbodies directly rather than simply adding force, the enemies still move extremely quickly whilst in air, but slowly on ground, in short they're still being affected by drag and mass, is there any way to fix this? I'm not currently moving them in fixed update, which I realise I should be doing, but I did try and it made no difference as far as I can tell, any possible solutions?

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 syclamoth · Sep 19, 2011 at 04:24 AM

Directly modifying the velocity of rigidbodies is dangerous because it can result in weird, non-physical behaviour. While you have definitely made the right decision to use rigidbodies instead of Character Controllers, I would try to actually use Rigidbody.AddForce to manage your movement- it makes it a bit trickier to code precise motion (especially for AI), but if you get it right it will make things much smoother.

As for your actual question- have you looked at what physic materials are on each of the colliders? Objects touching eachother (including the ground) have increased friction which is determined by the Physic material on each collider. Your slow movement on the ground is probably caused by this.

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 ungalyant2 · Sep 19, 2011 at 04:37 PM 0
Share

I'm actually not too concerned with unnatural movements, as instant snapping and instant start stop movements are fine for the game I'm doing (a dungeon crawler) so I don't even really want the smoothe movements. Unless there's a greater issue that I'm not understanding with that. Both the physics material for the floor and the enemies is set to none.

avatar image syclamoth · Sep 19, 2011 at 11:09 PM 0
Share

Aaah that's your problem- when you set the physic material to 'none', at runtime it automatically sets it to a default value! Look in your physics settings to find out what that is.

avatar image
0

Answer by Meltdown · Sep 19, 2011 at 04:59 PM

Try setting the physic material of your floor to ice or create a custom material with very low friction. Also reduce the settings on your drag and angular drag of the rigidbodies.

Checking out the Project Settings -> Physics, and learning/adjusting those factors can also change things up, it really is only a matter of reading this and this and modifying the variables you need to that will solve your problem.

And you really should apply all your forces inside FixedUpdate() else you may have different results on different computers based on Framerate.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Collision causes object to fly away at high velocity 1 Answer

Keep up with falling object - Touches 0 Answers

Rigidbody loses speed 1 Answer

Random velocity changes 0 Answers

Predicting trajectory using Equations of Motion considering drag & Magnus effect 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