I am trying to make that thing in which you blindfold with a bat and try to hit a hanging break-able treasure box sort of thing, but I am facing an issue, I have a test part connected to it, and it does not stop moving and comes to rest as it should do IRL.
Here’s the vid:
Not a permanent fix, but this is a bandaid solution I found:
local targetPosition = workspace.e.Position -- NAME TO YOUR OBJECT
local tolerance = 0.5
repeat
script.Parent.AssemblyLinearVelocity = Vector3.zero
task.wait()
until (math.abs(script.Parent.Position.X - targetPosition.X) <= tolerance and math.abs(script.Parent.Position.Z - targetPosition.Z) <= tolerance)
print("Broke")
- You can adjust tolerance as you like, place this inside a script under the part getting moved by the rope.
- You can also add a wait until this loop starts, if you want a bit of hanging first.
- Additionally, a breakout counter would be a good addition if you do end up relying on this; perhaps set the wait to .1 and counter to 1000. Anchor part and set position X,Z equal to ropepart and Y equal to ropepart position - ropelength
I tried using other constraints to no success, there’s probably a way but most physical properties don’t affect rope constraints (because their movement isn’t really limited by weight or other factors).
will align position can be used to align to rest?
I think I have found a more reliable solution to this, by using AlingPosition in a way, what that way is to add a part with an attachment to the final rest position, and one attachment in the bob of the pendulum type thing, add the align position with the rest position part anchored and CanCollide set to false.
Then we add the AlignPosition object with the following properties:
ForceLimitMode- PerAxis
ForceRelativeTo- World
MaxAxesForce- 500, 0, 500
MaxVelocity- inf.
Responsiveness- 5
This way the bob slows down and its speed decreases, thus when It reaches the rest position, it stops.
0 in the Y axis so it won’t pull the bob down and disrupt its motion.
(Error uploading reference video, sry, I will upload it as soon as it resolves.)
This is probably more effective then, I tried the first few solutions that came to mind but ultimately whatever you prefer and think looks the best is fine. My solution will work nonetheless, and yes you could change it to “AlignPosition” if you wished.
I didn’t quite understand your solution, can you please explain it? I would also try it, mine is a bit janky at the end so.
My solution was a very crude method of just reducing the parts actual linear velocity property. This gives the effect of the part “slowing down”. Once the part reaches the base of the rope, the loop breaks and the object will no longer be swinging around.