Hi, I have a simple question. I just need to move a part from point A to point B. I would prefer it to be as performance efficient as possible while looking smooth, so should I tween the part,use CFrame, or something else? Thanks
Whenever moving parts, you want to use body movers and constraints. Tweening is often done because it is simpler, but unanchored parts resting on top of a tweened part will not move with it.
Are body movers more efficient than tweening or cframing? It’s only one part that will move at a time, however there will be many moving seperate parts
Also the BodyPosition page says to use AngularPosition, but the AngularPosition page isn’t there?
Read the API on Tweening, Body Position, and directly changing the position.
Body movers are relative to Physics.
I get there’s probably no straight answer, but maybe there’s a general consensus on what to use to be more efficient.
Do you happen to know whether physics or directly moving the part through a CFrame loop is better?
if your making the part teleport then change the position
if you want it to travel smoothly then use body movers or tweening
Yep it’s an apple and pears comparison question. They are different methods with different purposes and results.
TweenService/CFrame/Position editing
Pros:
-
Reliable goes from start to goal without interuptions
-
Multiple movement styles, using tween Info instead of linearly going from point A to B without much difficulty, perhaps using tween info EasingStyle | Roblox Creator Documentation to make it look elastic, springy, and cartoony.
Cons:
- Cannot physically interact with the enviroment (apply force) hence can be unrealistic (phases through walls, doesn’t carry people along with the part if standing on it)
Bodymovers/Physics
Pros:
- Physically interacts with the enviroment as force is given to a part (can push other parts)
Cons:
- Can be interupted due to various reasons (physics bugs, Get’s stuck on another part, perhaps friction reduces the speed and stops it moving altogether, even other players taking network ownership over the part when they get too close so exploiters can do flinging) so not always reliable from A to B.
- Implementing custom movement styles is more difficult as you cannot simply set a tween Info property.
However there are also mixed solution using both tween service and bodymovers like this minecart:
Possibilities are endless.
It totally depends on the case of use.
If you want to directly change the position just do that.
If you want to just move a part without caring just use Tween service.
For example, you want to move a part along the x axis.
now a player comes in front while the part moves to it’s desired position,if you are using body movers the part might be pushed back(Depending on the force from both sides)
If you use tween service in that scenario the part won’t be pushed back or stopped by the player who came in front but rather just travels to get to it’s position.
Thank you! This is exactly what I was looking for. I’ll be using body movers