Problem with DragRigidBody script.

I am using the DragRigidBody script to allow the picking up on in-game objects (obviously) however when I release the mouse the objects appear to float, or at least fall very slowly as if they are, well, stuck in custard.

Is there something I’m doing wrong?

Hi, welcome to the forum!

The most common cause of this effect is that the models are very large in relation to the physics. It is easy to create a 1000 unit cube in a 3D app without noticing anything amiss, but when this is imported into Unity it behaves like a 1000 metre wide object under physics. The Unity primitive sphere (menu GameObject > Create Other > Sphere) has a radius of 1 unit, effectively 1 metre from the point of view of the physics. If your objects are very big in relation to the sphere, you should scale them down in the 3D app or within Unity itself.

I am only using a standard primitive cube created in Unity with the scale left to 1 for all axis.

I remember a similar thing happening when using Blender Game Engine where we wanted to disable physics on a single object however that wasn’t possible so instead we just set its velocity to 0 on every frame which in the end caused this “quicksand” effect like I’m seeing now, which we naturally used as a feature in our game for having quicksand obstacles :slight_smile:

Try starting the game off with the objects in the air and see how they fall naturally under gravity. If they fall at the expected rate, this would suggest something going wrong with the DragRigidbody script. If they fall slowly, you should suspect the physics settings (menu Edit > Project Settings > Physics) or scripts on the cubes, if indeed there are any.

I seem to have fixed it, because I wanted to be able enabled and disable the ability to drag the objects I had managed to have it constantly disabling the script. Without having it doing that it is all working fine now. Thank you for the help.