Drag Question

Hi! , I have One Rigidbody2D with a collider(the pentagon), I added rigidbody2D.AddForce in a script which allow the pentagon run and jump.

I didn’t know(And I still) how to keep the same force/velocity, I asked here in the forum and someone said that if I enable the Drag option of the rigidbody I could keep always the same force/velocity, It worked in some mode.

Well I have this:

As You can see the triangles have 2 colliders, The number 1 allow the pentagon to jump and the number 2 destroy the pentagon and restart the scene, everything is okei with that, all of this work.
When the pentagon is running and you jump to the 1st triangle ( to the 1st collider of course) everything works fine you can jump but when you are going to jump to the 2nd triangle the pentagon directly touch the collider Nº2 and not the Nº1, so it is destroyed.

The same happen if I start the scene and the pentagon falls from this distance:

I need to say that if I make the Collider 1 more big this doesn’t happen, but it looks ugly.

I disabled the Drag option of the Rigidbody ( I have put a value of 0, I had 1) and I tested it, and this doesn’t happen.

So, Do you know some ideas to avoid this? Thanks and sorry for the mistaked, the google translator works… meh hehe and I don’t know a lot of english :slight_smile:

Great explanation, thanks :slight_smile:

I would reduce the size of the number 2 collider. You often find that enemy kill colliders are noticeably smaller than the size of the enemy object(to give the player that little bit of an extra chance). And maybe leave a bit of a gap at the top of it between it and number 1, not too much but enough to make sure the pentagon collider never goes through 1 enough to come into contact with 2(which is what is happening at the moment). You can have the collider on a separate child object of the render object so it still looks nice but will work how you want it to, you could keep your original bigger collider 1 using this method if you prefer…

You might also want to play with your rigidbody interpolate settings a little(this will help even out the movement in between FixedUpdate’s, should be a lot smoother), as well as trying to adjust the collision detection setting on it for the player(pentagon) object(you might find no benefit from this option in which case put it back to the default setting).

I don’t know what add force method you are using and I would not argue against having some drag at all, but this line here gave me a pretty stable velocity so you are free to give it a try if you have not already :

rigidbody.AddForce (vDirection_Vector * Input.GetAxis("Horizontal") * fForce_Factor, ForceMode.Force);