- Home /
Why Is The Cube Sinking into Terrain ?
I have one cube and terrain. Both of them box collider and cube has Rigidbody. But still when ı press play, cube is sinking into terrain. Why is that ?
Those are my cube and terrain settings :
Is your terrain not just falling down all the time, don't think you need the rigidbody just the collider. When i recreate your setup to what i can see i get strange effects, i did manage to get the corner of the cube to sink into the terrain but it popped up out again. When i turn terrain rigidbody off every thing was normal
Answer by udunadmin · Feb 18, 2021 at 08:03 PM
Hi alpayoguz97, The terrain should stop the box perfectly in the setup you show, I think... The only thing that comes to my mind is that you could have some script that affects the position of the cube, like transform.Translate(). In that case, it is very likely to have penetrations like the one you have.
Firstly, thanks for answer. But there is no code like transform etc.
Those are codes that cube has
if(Input.GetKeyDown(KeyCode.G))
{
AudioClip audioC = cubeTouchClip[UnityEngine.Random.Range(0, cubeTouchClip.Length)];
cubeJumpSound.PlayOneShot(audioC);
Debug.Log("Jumped !");
rb.AddForce(Vector3.up * 100 );
}