# Is there some way to fix a springjoint to an specific angle?

Is there some way to fix a springjoint to an angle?

I’m trying to make a basic pressure plate based on weight. Which I plan on using a springjoint and a trigger under it to see if the objects affecting the plate are heavy enough. What I have right now is a box collider with rigid body limited on the Y axis and rotation with a springjoint attached, the box collider being a child of the trigger. But right now it fails both if the pressure plate is not at 180 or 0 degrees and fails the moment the weight on it becomes too heavy.

I tried fixing the weight issue with:

``````    void FixedUpdate()
{
if (transform.localPosition.y <= 0)
{
transform.localPosition = new Vector2(transform.localPosition.x, 0);
}
}
``````

But without luck, as the moment it becomes too heavy the objects on the pressure plate phase to the pressure plate. I assume due to the objects on it not being updated and thus slowly get pushed into the pressure plate. And the angle issue I have right now I suspect is due to rigidbody2D movement restrictions apply to worldspace, not local. Being able to fix the X position in local space instead of worldspace would probably also fix the angle issue. Though I have no clue on how to do that.

Physics won’t work if you’re messing with the Transform. That’s the main job of a Rigidbody2D so don’t go stomping over what it’s done. There’s lots of movement related API on the Rigidbody2D you can use.

Honestly, a lot of words are not good at demonstrating a dynamic issue with a joint. It’s best demonstrated with a set of images or video if possible.

A SpringJoint2D won’t cause any rotation if it’s connected to the center of mass of the Rigidbody2D in question so rotation is likely from contacts. Obviously you can constrain rotation but honestly, I don’t think I understand your set-up at all.

Already fixed the issue using 2 Wheel Joints. What I meant with rotation was to fix the rotation of the spring, not any of the objects it’s connected to so it would act like a fixed spring rather than one attached to some pivot point.
And combined with some math and a trigger collider I can measure if the weight required was met.

For anyone interested:

Yellow being the upper side of the trigger, and the green 2 Wheel Joints and the rigidbody that acts as the scale platform in black. Gravity scale has 0 gravity and has a fixed rotation on the rigidbody. You can probably do it with just 1 Wheel Joint if you just plan on using it flat on the ground, but I wanted a weight dependant push button for any angle.

Hope it makes a bit of sense now.