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

How do I stop my CFrame Lerping from flinging the plane?

Asked by
sasial 26
2 years ago

As you can see in the video, the plane is flinging when it moves:

Code: (ran on heartbeat)

01const delta = (tick() - this.delta) / this.speed;
02if (delta < 1) {
03    print(delta);
04    const position = new CFrame(this.path[0].CFrame.Position).Lerp(
05        new CFrame(this.path[1].CFrame.Position),
06        delta,
07    );
08    const orientation = this.plane.Move.CFrame.sub(this.plane.Move.Position).Lerp(
09        this.path[1].CFrame.sub(this.path[1].CFrame.Position),
10        delta,
11    );
12    const pivot = position.mul(orientation);
13    this.plane.PivotTo(pivot);
14} else {
15    if (this.path.size() > 2) {
View all 22 lines...

yes the code is in roblox-ts, but it'll be the essentially same in lua (with the except of the .sub macro compling to just a -)

Answer this question