How to collide objects with high speed in Unity

后端 未结 2 1184
心在旅途
心在旅途 2020-12-18 23:54

I try to create game for Android and I have problem with high speed objects, they don\'t wanna to collide.

I have Sphere with Sphere Collider and Bouncy material, an

2条回答
  •  清歌不尽
    2020-12-19 00:10

    See:

    1. Similar SO Question
    2. A community script that uses ray tracing to help manage fast objects
    3. UnityAnswers post leading to the script in (2)

    You could also try changing the fixed time step for physics. The smaller this value, the more times Unity calculates the physics of a scene. But be warned, making this value too small, say <= 0.005, will likely result in an unstable game, especially on a portable device.

    The script above is best for bullets or small objects. You can manually force rigid body collisions tests:

    public class example : MonoBehaviour {
        public RaycastHit hit;
        void Update() {
            if (rigidbody.SweepTest(transform.forward, out hit, 10))
                Debug.Log(hit.distance + "mts distance to obstacle");
    
        }
    }
    

提交回复
热议问题