Search Unity

How Avoid Jiterring On Fixed Joints?

Discussion in 'Physics' started by platinio2007, Apr 12, 2019.

  1. platinio2007

    platinio2007

    Joined:
    Jul 17, 2015
    Posts:
    17
    Hi guys, so i am working on a VR game, and i use fixed joints to paste together arrows and objects, but when to many arrows are joint in the same rigidbody, i have some very noticeable jittering.

    You can see the error in this small video
    i try a lot of diferent stuff like increasing Fixed Timestep, Solver iteractions, using configurable joints in locked mode and playing with the values in the inspector, but nothing works.

    can someone help me?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    1,972
    I'm not sure how to solve this via physics (I don't work in 3D physics) but it seems like the best solution is to place the arrow as a child transform of the box (and turn off physics for it) rather than waste CPU cycles trying to get physics to keep it in a fixed relative position.
     
  3. platinio2007

    platinio2007

    Joined:
    Jul 17, 2015
    Posts:
    17
    Hi thanks for your reply, and really that was my first approach to this arrow pasting problem, but that introduces new errors, like no uniform scale objects when parented change the scale of the arrow, and something that i want for the game is that if i lauch a arrow to an apple for example i can grab the arrow and the apple keep paste to the arrow or if i grab the apple the arrow still there, and that already works but just using fixed joints.

    i imagine i should keep track the numbers of arrows peer object and destroy arrows before this happens, but whould be better if i can fix it.
     
  4. chasekubesh

    chasekubesh

    Joined:
    Jul 25, 2019
    Posts:
    1
    Try putting the box and the arrow on layers that can’t interact with each other, after you parent the arrow to the box. This should allow you to interact with both, while they can’t interact with each other, and therefore don’t jitter. To set the layers, you can go into the top of the inspector view of each object and add custom layers, say “Arrow” and “Box”, and in the physics editor (edit > project settings > physics) there is a bunch of checkboxes that correspond to layer collisions, and if you set “Box/Arrow” to False, they won’t interact. Now all that’s left is to switch the arrow from the default layer to the “Arrow” layer after the collision registers, and your golden.