How can I pivot an object? Unity2D

I have an object (Red) that needs to stay within a certain distance of another object (Blue). when I press a button, AddForce is applied to the bottom of the object and when it is in the air it inherits the rotation of the stick.

The problem is, is that the object flies away from the stick. Is there a way to lock a position relative to the way the object is facing kind of like using transform.right?



Have you tried using a Relative Joint 2D/Distance Joint 2D?

  • Switch off your current “inherit code”.
  • Ensure all objects have a Rigidbody2D, and 0 gravity if so desired.

On your main object:

  1. Click Add Component.
  2. Select Physics2DRelative Joint 2D OR Distance Joint 2D.
  3. Drag the object you want into Connected Rigid Body.
  4. The object should now stay a certain distance away, at all times.

You can pivot an object in the Editor in the transform section. If you want to combine them, simply put them in an empty game object together

i haven’t seen pivot section?