Make an object/the floor 'sticky'?

I have two objects: a ball and a box. In my game you need to get the ball into the box. Unfortunately I’m having trouble with the ball bouncing out of the box (it’s a bouncy ball).

I want to the ball to stop bouncing if it enters the box (though it will need to feel reasonably natural).

I’ve been experimenting with the physics.

I lined the bottom of the box with a material with 1 friction and 0 bounciness. This helps a bit, but the ball’s bounciness tends to overcome it.

Is there a way to use a force to ‘suck’ the ball down and dampen its bounciness (I don’t want to modify the ball’s properties as it has just the right properties for the game)?

If you absolutely don’t want to change the ball property on collision, then yeah, you could just AddForce or set the velocity directly.

On your ball script:

OnCollisionStay(Collision colObj)
{
//We check to see if the surface we collided with has the tag of our hole, so we don't trigger this on any collision surface
   if(colObj.gameObject.tag == "tag name of your box/hole, preferably only the bottom collider")
   {
//Set only the Y axis of the velocity to a custom value, while leaving the existing x/z velocities intact by using them as the input value
       rigidbody.velocity = new Vector3(rigidbody.velocity.x,downForce,rigidbody.velocity.z);
   }
}

Thanks, I’ll try that out. Sounds like it’s exactly what I need.

This technique absolutely works!

I have fiddled with the code to get what I want. Here is the code from my OnCollisionEnter2D method. I’ve hardcoded a value of (divide by) 1.7 for my force, and this seems to work well, though I will test and tweak as required.

  if (other.collider.gameObject.name == "BottomCollider")
            rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, rigidbody2D.velocity.y / 1.7f);

thanks for the help, it’s really appreciated.

u can just use RigidbodyConstraints.freez for ball or kinematic it