I’m currently making a gun sim type game, this is how far I’ve gotten:
The slide shouldn’t be able to go off the gun like that ofc, but how do I detect if the part is outside a certain bound and put it back?
I’m currently making a gun sim type game, this is how far I’ve gotten:
you can use Magnitude to compare position
so in this situation you need to get the Magnitude of the slide then you get the magnitude of the handle
and then you do something like this
if (HandleMagnitude - SlideMagnitude) > BoundMagnitude then
---stuff here
end
what would handlemagnitude and boundmagnitude be?
handleMagnitude would be Handle.Position.Magnitude (The red circle)
BoundMagnitude would be somewhere in the green circle

just pick a random number for BoundMagnitude (around 1 to 10) if the slide still goes out of bound then reduce the BoundMagnitude until you are statisfy with the result