Hi
I have this problem: I’m using a 2D sprite with a box collider in my 3D space. if my sprite collides with my box for example, then it starts climbing… i have been trying various things so far, like storing position of X and Z and use use that to stop the rigid body on collision, but nothing seems to work.
the following gif should show the problem.

my movement script looks like this:
void Movement ()
{
posX = transform.position.x;
posZ = transform.position.z;
moveX = Input.GetAxisRaw ("Horizontal");
moveZ = Input.GetAxisRaw ("Vertical");
gravity = rigidbody.velocity.y;
rigidbody.velocity = new Vector3 (moveX * horizontalSpeed, gravity, moveZ * verticalSpeed);
}
void FixedUpdate ()
{
Movement ();
}
void Jumping ()
{
Debug.Log ("You Jumped");
rigidbody.AddForce (Vector3.up * jumpStrength); //Add force on y axis
}
void Dropping ()
{
Debug.Log ("You are dropping");
rigidbody.AddForce (Vector3.down * 20);
}
void Update ()
{
if (Input.GetButtonDown ("Jump") && ground == true) {
Jumping ();
ground = false;
}
if (!ground && rigidbody.velocity.y < -0.0) {
dropping = true;
Dropping ();
}
}
void OnCollisionEnter (Collision col)
{
if (col.gameObject.tag == "World" || col.gameObject.tag == "Platforms") {
rigidbody.velocity = Vector3.zero;
ground = true;
dropping = false;
Debug.Log ("You are on ground");
}
}
Yeah so i accepted my earlier “fix” and take that as a solution… I added a physics material to my rigidbody and my cube, set the static and dynamic friction to zero, that fixed the problem. I’m going to use this for now, although i’ve read that this can turn into a problem later, so it might not be the best way to get around this collision problem.
You could try putting constraints on the rigidbody.