How to move a part smoothly at a constant speed?

Hello. I am making an RTS game and I’ve got into this problem when I was changing the humanoid object to BodyPosition. BodyPosition is not constant, so it is not useful for me. What are the recommended things that I should use in order to move a tank at a constant speed without using humanoid:MoveTo()?

1 Like

BodyVelocity works.

Or just use a tween with linear tweenStyle

3 Likes

Alright, but I noticed there’s a problem with bodyvelocity where the position rendered is different from the position in the script

1 Like

I would recommend Tweening. Its the easiest that I think will work for you.

1 Like

Does collision still stay with tweening?

No. Can you explain in detail of what you’re trying to do?

1 Like

Here: https://gyazo.com/296ae9ac0a39a09ca9e3e2a140e55087 with a TANK

Looks like tweening should do the job since you’re not colliding with too many objects.

1 Like

Well, not really since that game has collision. Plus, colliding with buildings.

Just make a raycast to stop tweening if it hits an object

1 Like

I am thinking just using velocity since it’s the easiest to use in this case.

Sure! Both ways work just with a few differences

1 Like

TweenService is intended mainly for non-physically-simulated things, like UI, or client-side cosmetic effects. You generally should not use it to directly tween the position of things that have any physical interaction. You can technically tween a part by proxy, by tweening the Position of a BodyPosition, or Attachment that AlignPosition is referencing, but there are often simpler ways to script this than by using TweenService.

2 Likes