- Home /
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?
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.
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.
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.
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.
Your answer
![](https://koobas.hobune.stream/wayback/20220612215448im_/https://answers.unity.com/themes/thub/images/avi.jpg)