Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Unexpected axis constraint with Prismatic joints

Discussion in 'Physics for ECS' started by Occuros, Apr 8, 2022.

  1. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    The prismatic joint works as expected. But when I inspect the Constraint on the constrained body pair, it is not really clear to me why the respective constrained axis is chosen that way.

    If I want to have a prismatic joint where the entity can glide along the y axis, I expected to find a constrained axis on X and Z (with Min: 0, Max: 0) and a constraint on the Y-axis with Min:0, Max: 1).

    Instead, I find the X-axis constrained with Min: 0, Max: 1, and the Y and Z axis Constrained with Min:0 Max: 0.

    I'm sure I am missing something simple about why these constraints are defined on the other axis then I would have expected, but any help would be appreciated.

    primsatic_join_go.png primsatic_join_entity.png
     
  2. Occuros

    Occuros

    Joined:
    Sep 4, 2018
    Posts:
    300
    I think, I understand now.

    Prismatic constraint (for the sliding) is always on the X axis, and we can define the world direction of that sliding by defining the coordinate system of the joint with the the axis (axis local, axis perpendicular) we define (and the third is calculated with the cross product).