Unity Collider and rigid body Collider performance comparison

Source: Internet
Author: User

Test method:

Each object has a large range of sine movement, creating 1000-5000 objects to ensure real-time update of the scene segmentation tree and testing the frame rate

Test script:

To move a script:

usingUnityengine;usingSystem.Collections; Public classtest1:monobehaviour{ PublicRigidbody rigidbodyobj; voidUpdate () {Switch(Random.range (0,3))        {             Case 0: Transform.position= Vector3.forward * Mathf.sin (Time.time * the) * the; //rigidbodyobj.position = Vector3.forward * Mathf.sin (Time.time *) *;                 Break;  Case 1: Transform.position= Vector3.left * Mathf.sin (Time.time * the) * the; //rigidbodyobj.position = vector3.left * Mathf.sin (Time.time *) *;                 Break;  Case 2: Transform.position= Vector3.right * Mathf.sin (Time.time * the) * the; //rigidbodyobj.position = vector3.right * Mathf.sin (Time.time *) *;                 Break; }    }}
View Code

Generator script:

usingUnityengine;usingSystem.Collections; Public classtest2:monobehaviour{ Public intCount =10000;  Publicgameobject template; voidAwake () { for(inti =0; I < count; i++)        {            varGo =instantiate (template); Go.transform.position= Random.insideunitsphere *10f; }    }}
View Code

Test results:

i5 under the configuration

500 Dynamics Open Rigid body collider is already less than 20fps, using rigidbody.position to move and use transform.position movement is not very different. and 500 rigid bodies with gravity open, collider only 3fps.

10,000 non-rigid collider can reach 30-35fps and are independent of whether the switch trigger. Since the non-rigid body collider is a passive trigger, I have also tested a situation where there is no collider, and it seems that the frame rate is fast 1-2fps and relatively stable, and may be an illusion.

Unity Collider and rigid body Collider performance comparison

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.