Search Unity

Rigidbody2D Missing Features

Discussion in '2D' started by Keshav, Nov 29, 2013.

  1. Keshav

    Keshav

    Joined:
    Jan 17, 2013
    Posts:
    11
    I have migrated from 3D to 2D physics. The Collision Matrix for 3D Rigidbody interaction is not documented for 2D.

    This is the matrix for 3D rigidbody.
    http://docs.unity3d.com/Documentation/Components/class-BoxCollider.html

    I have come across the following differences between 3D and 2D physics.
    Would help if somebody could clarify these points.

    1) I discovered that if two Kinematic Rigidbodies interact, NO Trigger Events are fired, where as it would work in 3D.
    Is this intended behaviour or a bug?

    2) RigidbodyConstraints for 2D is missing. Why is this not included?

    3) Consider this hierarchy,

    Parent (Rigidbody,No Collider)
    ---Child (Collider)

    In 3D System, Physics events are sent to child as well as parent object
    In 2D System, Physics events are sent to only child object

    What is the intended behaviour for this scenario?

    4) In 3D, A RayCast originating inside a collider, ignores that collider, whereas, in 2D, raycast will hit the collider. what will be the behaviour?
     
    Last edited: Nov 29, 2013
  2. DrKucho

    DrKucho

    Joined:
    Oct 14, 2013
    Posts:
    140
    same here, i am novice in unity but same as you i started my project in 3D physics ignoring/locking the Z for a 2D game and switched to real 2D in the new unity version , but there is a lot of stuff that is different or missing, these are the thing i miss

    - HingeJoint2D.angle does not exist but it does in 3D
    - HingeJoint2D.motor.motorSpeed exist , but which one is the variable for "Maximum Motor Force" (that's on editor), the script reference in unity website is missing ( http://docs.unity3d.com/Documentation/ScriptReference/HingeJoint2D-motor.html )

    anyway i am pleased with the 2D engine, its much more stable than the 3D, just like Box2D and the one inside Corona SDK , rigid bodies won't vibrate like crazy when interact to each other, my project was having awkward behavior all the time on 3D , but now is ok
     
  3. DrKucho

    DrKucho

    Joined:
    Oct 14, 2013
    Posts:
    140
    oh! by the way , for kinematic bodies not colliding , try not setting it to kinematic but gravityScale parameter set to 0
     
  4. tanaybhargava

    tanaybhargava

    Joined:
    Dec 26, 2012
    Posts:
    1
    For OnTriggerEnter
    This message is sent to the trigger collider and the rigidbody (if any) that the trigger collider belongs to, and to the rigidbody (or the collider if there is no rigidbody) that touches the trigger. Note that trigger events are only sent if one of the colliders also has a rigidbody attached.

    For OnTriggerEnter2D
    This message is sent only to the trigger collider and the collider that touches the trigger. Trigger events are only sent if one of the colliders also has a rigidbody attached somewhere in the trigger itself or in one of its parent gameobjects.
     
  5. Keshav

    Keshav

    Joined:
    Jan 17, 2013
    Posts:
    11
    Continued:

    5) Consider the Hierarchy:

    Parent (Rigidbody, non-Kinematic)
    ---Child (Rigidbody, isKinematic)

    In 3D, If Parent Moves, its kinematic children move along with it.
    In 2D, If Parent Moves, its kinematic rigidbody children don't move along with it.

    What should be the actual behaviour of the 2D Physics?
     
  6. littlepolygon

    littlepolygon

    Joined:
    Jul 7, 2013
    Posts:
    16
    >> What should be the actual behaviour of the 2D Physics?

    Consistency
     
    DricoJD likes this.
  7. blackbeetle

    blackbeetle

    Joined:
    Jun 12, 2014
    Posts:
    4
    I also find the behaviour of rigibody2D.MovePosition() is different from rigibody.MovePosition().
    In 3D, apply gravity, but 2D not apply gravity
     
  8. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    The above behaviour differences have been resolved in 4.5.

    There's also a few extra things being added to 4.5 patch releases that resolve the final issues.

    The MovePosition issue you mention has been fixed and will be in a forthcoming patch release (keep an eye-out for the release notes).

    A ray/line casts starting inside a collider will have an option to allow you to select whether you want this behaviour or not (to be released as part of the same patch release).
     
    DricoJD likes this.
  9. blackbeetle

    blackbeetle

    Joined:
    Jun 12, 2014
    Posts:
    4
    Nice job!
     
  10. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    Thanks.

    The changes I mention above are in 4.5.5p2 (not out yet).
     
  11. Kiori

    Kiori

    Joined:
    Jun 25, 2014
    Posts:
    161
    This is great news!
     
  12. Ahsan_mughal

    Ahsan_mughal

    Joined:
    Mar 30, 2018
    Posts:
    10
    #unity is updated!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
     

    Attached Files:

    • F.png
      F.png
      File size:
      45.3 KB
      Views:
      895