+2 votes

The docs for this function:

  • Vector2 cubicinterpolate( Vector2 b, Vector2 prea, Vector2 post_b, float t )

Cubicly interpolates between this Vector and “b”, using “prea” and
“post
b” as handles, and returning the result at position “t”. “t”
should be a float of 0.0-1.0, a percentage of how far along the
interpolation is.

I'm not sure what to pass for pre_a and post_b.
There's not much on this on Google.

in Engine by (4,077 points)

I think it has something to do with bezier curves. You know, you need 4 points to do a cubic interpolation. May be that are the 2 missing points. IDK, but i vote up your question because it would be nice to have explanation.

2 Answers

+2 votes
Best answer

So I created a scene so you can test out the function with drag and drop.
Click on the image below to see the .tscn file on GitHub.

GraphicEdit

by (4,077 points)
selected by
+2 votes

Hi, as i commented, i was not sure, so i asked in IRC... this was the answer:

[15:17] p7f: prea and postb are handles, indeed similar
to those for a besier curve
[15:17] the result curve will be tangential to the pre_a - a line at a, I assume
[15:18] best way to choose them is to try with some values first, see what result it produces, then proceeding from there
[15:18]

bojidarbg: so it should be also tangencial to b - post_b?
[15:19] yeah, at b
[15:19] bojidar
bg: thanks a lot!

Is not my merit this answer, but i post so others can see anyway.

by (3,394 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.