Search Unity

Constraining Rigidbody Position Along an Arbitrary Plane

Discussion in 'Physics' started by w0nche0l, Apr 9, 2019.

  1. w0nche0l

    w0nche0l

    Joined:
    Feb 21, 2015
    Posts:
    4
    Hello all, is there any way to easily constrain Rigidbody Positions along an arbitrary 3D Plane/Axis? I know that you can constrain them along the world space X, Y, and Z axes.
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    You could make a transform as the 0,0,0 of your grid with the wanted rotation and have some logic that manually clamps them to w/e axis you want with the transforms local position.

    *could also do it with just a quaternion, no actual need for the transform or its game object, but it's much easier to work with unless you're a wizard with math and it's an overkill opt unless you have a lot of those pivots.