- Home /
Make object stay inside circle
Heyo, I want to make it so an object (has Rigidbody2D) can not leave a designated area. The object is moved by AddForce in the direction of the mouse. When I reset the transform.position to the closest area that is still in the circle once it leaves the circle, it gets stuck at the edge of the circle because it still retains the velocity. I don't want to lose the velocity though, so how can I redirect the velocity the object has so it doesn't get stuck at the border of the circle, doesn't lose its velocity and just moves along the border instead of leaving it? Thank you in advance :)
Answer by Casiell · Dec 20, 2019 at 08:50 AM
Use physics joints for that. I think Distance Joint 2D with Max Distance Only selected would be best for this
Thank you very much. Distance Joint 2D was what I was looking for.
Your answer
![](https://koobas.hobune.stream/wayback/20220612220420im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Does rotation increase velocity? 0 Answers
How to not get velocity by the other objects?,How to not get force by other gameobjects? 0 Answers
Convert Force into Velocity for 2D Player Jump 0 Answers
How can I get 2 rigidbody2d objects to "share" physics? 1 Answer
Adding force to rigidbody2d to slide 1 Answer