Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Physic perfomance - isTrigger, Kinematic Rigibody vs Rigidbody Freeze

Discussion in 'Physics' started by Suduckgames, Jul 9, 2018.

  1. Suduckgames

    Suduckgames

    Joined:
    Nov 28, 2016
    Posts:
    53
    Hi, I am trying to figure out the pros/cons of using both approaches

    I have a typical space arcade where you have your ship and you kill the enemies that come with them

    I don't want the physic to drive any object since I am on the space and when "something" collide to "something" It just destroy the object and make some changes. I use it for shoots and drops (since they only need to advance in Z axis and make something when they enter in the trigger of the ship)

    So with that definition I should use RigidBody with "isKinematic" set to true, and "isTrigger" on the collider, however in the documentation about colliders it says

     Kinematic rigidbodies should be used for colliders that can be moved or disabled/enabled occasionally but that should otherwise behave like static colliders.


    So If I follow this line, the best approach should be to make the RigidBody "non-Kinematic" and just freeze the position and rotation on all axis, so I can just drive them by the transform component.

    In my understanding making a RigidBody non kinematic, allow the physic engine to check for the object (even when the rotation and position is freeze).

    So which one should I use and why? (From performance view)
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    1,119
    That documentation is outdated. Using Kinematic bodies with non-trigger colliders is perfectly fine in your case IMHO.

    You need to enable the contact pairs in order to the collision events to be called (OnColliderEnter, etc). Edit > Project Settings > Physics:

    upload_2018-7-9_16-0-55.png

    Also, ensure to move your bodies via Rigidbody.MovePosition and Rigidbody.MoveRotation from FixedUpdate. Enable Interpolation in the bodies for smooth movement.