Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I allow a part to only move in the direction it is facing?

Asked by 3 years ago
Edited 3 years ago

This seemed easy enough, but I was surprised to find out how difficult and maybe not even possible it actually is to achieve. I know that you can use a body velocity and make it keep a velocity of 0 in a specific axis but I need it to be able to do that in an axis relative to the part. Here's a picture describing what I mean:

https://ibb.co/zVZVQyZ

Green means that it's allowed to move in this direction/axis

Red means that it's not allowed to move in this direction/axis

0
What do you mean by allow? You mean like pushing it with physics Nd only allow it to go in a certain direction forwards or backwards? Or so you want to move the part with a script? AlexanderYar 788 — 3y
0
I mean that if some force, any force tries to push the part on its x axis (relative to the part), it won't be able to. It will only allow movement of the part on its z axis (again relative to the part) ClintBlocker 0 — 3y
0
Nobody's answering so I assume that it's not possible? ClintBlocker 0 — 3y

2 answers

Log in to vote
0
Answered by
Ascarson4 138
3 years ago

Check out look vectors.

0
I've checked that out. It doesn't work ClintBlocker 0 — 3y
0
Use BodyVelocity and then set the BodyVelocity of the part to part.CFrame.LookVector * (whatever your speed is) Ascarson4 138 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Either constantly make it stay on the same number for the axis you want the same, using a while true do loop, or anchor the part and detect when it's touched and move it, this way, you can control where it goes and it never goes off the axis unless you tell it to

I hope this helps :3

Answer this question