Search Unity

What is by the far most interesting, unintuitive or jaw-dropping thing you've come across while stud

Discussion in 'Physics' started by andrew866, Apr 17, 2021.

  1. andrew866

    andrew866

    Joined:
    Apr 17, 2021
    Posts:
    1
    Anybody have any particularly interesting experiences? Needless to say though, all of physics is a beaut :)
     
  2. Deleted User

    Deleted User

    Guest

    When I realised how similar and yet how complete different Java and C# are. This made calculating physics way harder for me, because I am used to Java.
    Oh, and when I found out my movement scripts are proof of Vector addition being actually applicable and making my code 27 times longer to circumvent addition.
     
  3. John_Leorid

    John_Leorid

    Joined:
    Nov 5, 2012
    Posts:
    651
    Layersystem is used for rendering AND physics at the same time.

    You cannot exclude a single collider from a raycast check, except if you disable it/move it to another layer right before the check happens.

    Speculative collision checks will collide prior to the actual collision and return wrong Collision events - so when my projectile exploded before hitting the ground, the collision data returned basically its current position, instead of the point on the floor.

    Renaming all FixedUpdate() calls to Update() almost doubled our framerate even when Update() happens 90 times per frame and FixedUpdate() only 50 times per frame - still confused why, but I guess I'll just accept the performance boost.

    You can't disable Joints, you have to delete them, which kind of breaks our pooling system .. haven't found a good way around this problem yet.

    Character Controller Collision Flags are strange. It has a slope detection implemented but doesn't let you access the data (the slope of the floor) so you have to do your own check and hope that the data is equal to the one of the character controller ..

    (non moving) Triggers are way, way more performant than Physics.OverlapSphereNonAlloc().

    Physics.OverlapBoxNonAlloc & Physics.OverlapBox definately need a draw method - I spent hours just testing what rotation the virtual box actually has, then found out that it changes based on the player rotation and skipped the whole thing after two days - it is an OverlapSphere now.