I know I could just create a loop and change the CFrame of the block constantly, but I already have everything set for using body position. (I just want the block to glide Once, not in a loop)
Can you specify what you mean by glide? And what situation is this going to be used in?
Smoothly moving from one position to another.
Well from the information I have, I’d suggest just using a for or while loop to constantly position the BodyPosition a certain distance in front of the part, but an easier solution, like you said, is to just use lerping, CFrames and for loops.
Okay, I’ll go with the CFrames.
If you’re not concerned about orientation and you only need it to move to a position, a BodyPosition would work fine. Just add a BodyPosition into your part and then set the Position property to whatever position you want to move it to.
You can tweak the other properties (Dampening, power, max force) if you don’t like the way it moves.
Here’s the API reference if you need it:
That doesn’t work for me because I only need to glide it once, If i put it in a loop it does gilde perfectly.
To create a smooth movement, what you can do is something like this
local RS = game:GetService("RunService") for i = 1, 1000 do --Can change 1000 to something else Part.CFrame = Part.CFrame:Lerp(Part.CFrame * CFrame.new(0,0,10), 0.1) --You can change the "10" value to adjust speed RS.Heartbeat:Wait() end
Or if you want something more appropriate for your case, you can set a variable and say
while -variable- do Part.CFrame = Part.CFrame:Lerp(Part.CFrame * CFrame.new(0,0,10), 0.1) RS.Heartbeat:Wait() end
so that way it stops gliding when you want.
P.S, “CFrame.new(0,0,10)” might be in the wrong direction for you so you might have to make it a negative number or change its position to the X or Y
I’m a little confused by your wording. Could you clarify: By gliding, you mean smoothly moving from one position to another? And you want to do that only one time?
It also might help if people knew what exactly you plan on using this for. Is this for a moving platform? A visual effect? A projectile? Etc.
Knowing the context means we can figure out the best solution for your case instead of offering a method that may not be the best fit or might not even be applicable to the situation.