How to move a part with BodyVelocity

How do I use BodyVelocity and BodyAngularVelocity to move a part to a point and rotate it so it is in an organic turning shape?

Untitled

I’ve tried BodyPosition but it doesn’t turn the part and it doesn’t have that nice curve.

1 Like

You’d need to balance the MaxForce property if you’d want it to slide & slowly lose traction, and change where the Velocity would go every couple of seconds to reach its destination

The thing about a BodyVelocity is that it’ll only go in 1 direction unless otherwise changed, so you’d need to adjust its position a bit frequently

Another thing is that you can use Bezier Curves:

1 Like

How would I do this in code? Also there’s only two points

Thing is, even if you have 2 points you’d still need to move the first point in a curve of some sort

I don’t know how you could implement it, but you’d need to experiment around with them by Lerping them I’m assuming

1 Like

Im trying to mimic a sorta fish behaviour

If I set the BodyVelocity to always move forward (Using look vector), how would I use BodyAngularVelocity to orient the fish towards a point? Also, I don’t really like the harsh turn they make. When BodyAngularVelocity’s are (0,0,0) and they go to (0,5,0) in a tick, they turn nicely. But if you go from (0,5,0) to (0,-5,0) it just instantly turns. It will be better if the rotation was more like a PID controller.

There are 3 points in a quadratic biezer curve.

1 Like
HitBox.CFrame = CFrame.new(HitBox.Position, Point)
BodyGyro.CFrame = CFrame.new(HitBox.Position, Point)

I found this code somewhere, but it doesn’t smoothly turn.

This rotates more smoothly but doesn’t work all the time (Only on certain angles)

local VelBase = HitBox.CFrame.LookVector:Cross((Point - HitBox.CFrame.p).Unit).Unit
BodyGyro.MaxTorque = VelBase

How would I combine them to make something that works all the time and turns smoothly?

Figured it out!

local Direction = (Point - Body.Position).unit
local Position = Body.Position + Direction
BodyGyro.CFrame = CFrame.new(Position, Position + Direction)

Thanks for not helping me at all. :unamused:

1 Like