How to make a part slide in one direction

I am trying to create a snowboarding/hoverboard system for a new side project, but I’ve been struggling on one aspect. I’ve been trying to make it so that a certain part will only slide in one direction, dependant on the part’s rotation. The end result I’m looking for is for the part to be able to slide forward and back, and fall up and down as normal, but not be able to slide sideways.

what I have tried so far is to use a body velocity set to a velocity of (0, 0, 0), and then make the max force equal to the right vector of the part, times a certain amount. This solution works fine for a part facing in exactly 90-degree increments (north, south, east, west), but when the part is on a different angle, the forwards sliding is affected, a lot of the time resulting in the part being stuck in place.

all I really want is a different method to achieve this, or how to fix the method I tried. Thanks!

just use the lookVector property of Cframes, this would require you to have some sort of root part with the lookVector facing the front face, up vector facing the top face and right vector facing the right face.

this is what I’m currently using to orient the maxForce, but it doesn’t work, as when the part is facing 45 degrees, it won’t move at all when the max force is too high, but it if the max force is too small the part slides sideways.

Still havn’t found a solution :frowning:

I’ve solved it! What I do is I set the maxForce to the lookvector of the part, times the mass of the part, and then times the gravity of the game!


ps. make sure that the velocity of the body velocity is set to 0,0,0

EDIT: You need to use math.abs to make all of the values of the resulting maxForce positive, otherwise the board will fly off into space