我地上用个cube变型成个地板,顶上放个小球,把小球变成钢体加上代码,结果一运动直接无限下降。。。
为什么会穿过地板?_按方向键,小球确实可以左右移动_
Rigidbody rb;
rb = GetComponent<Rigidbody>();
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(h,0.0f,v); //0.0f !
rb.AddForce(movement*speed);
我把地板变成钢体,地板也一直往下掉。。。
https://zhidao.baidu.com/question/509077607.html
你给Cube加一个碰撞器就可以了
地板和小球的collider中,is trigger都不要打勾,地板不要刚体,小球加刚体有重力,应该就没问题了