Make rigidbody freeze to an object's axis

Hello, I know I can freeze the position of a rigidbody along a global axis, but is there a way of freezing a rigidbody to an objects axis? Here’s a little diagram to show you what I mean. Can I do this with a configurable joint? Thanks!

2835-track.jpg

all what actually doing ‘freezing along world axis’ is just resetting every FixedUpdate it’s speed component. so all you should do is reset your compounded speed component.

this is one of way to take only speed direction you need

so,

Vector3.Project(rigidbody.velocity, trackTransform.forward)

returns speed relative to track. apply it back to rigidbody and all slide speeds will be resetted to zero