diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-06-22 18:30:27 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-06-22 18:30:27 +0200 |
commit | 0c4188fe32c9858f5921d9497cd1943e14e9c24f (patch) | |
tree | 773429f2a658b551f4bd05e574cab98e7da57e6a | |
parent | 100082b3acdef950dded744bda7ff16cc30afaaa (diff) | |
parent | 77491d0a62454f22ebb44142d4e570735cbc6ad7 (diff) | |
download | redot-engine-0c4188fe32c9858f5921d9497cd1943e14e9c24f.tar.gz |
Merge pull request #78362 from AThousandShips/doc_curve_fix
Clarify the return value of `Curve2D.sample_baked_with_rotation`
-rw-r--r-- | doc/classes/Curve2D.xml | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/classes/Curve2D.xml b/doc/classes/Curve2D.xml index abf71c5754..59cf96b0e7 100644 --- a/doc/classes/Curve2D.xml +++ b/doc/classes/Curve2D.xml @@ -107,11 +107,16 @@ <param index="0" name="offset" type="float" default="0.0" /> <param index="1" name="cubic" type="bool" default="false" /> <description> - Similar to [method sample_baked], but returns [Transform2D] that includes a rotation along the curve. Returns empty transform if length of the curve is [code]0[/code]. + Similar to [method sample_baked], but returns [Transform2D] that includes a rotation along the curve, with [member Transform2D.origin] as the point position, [member Transform2D.x] as the sideways vector, and [member Transform2D.y] as the forward vector. Returns an empty transform if the length of the curve is [code]0[/code]. [codeblock] - var transform = curve.sample_baked_with_rotation(offset) - position = transform.get_origin() - rotation = transform.get_rotation() + var baked = curve.sample_baked_with_rotation(offset) + # This will rotate and position the node with the up direction pointing along the curve. + position = baked.get_origin() + rotation = baked.get_rotation() + # Alternatively, not preserving scale. + transform = baked * Transform2D.FLIP_Y + # To match the rotation of PathFollow2D, not preserving scale. + transform = Transform2D(baked.y, baked.x, baked.origin) [/codeblock] </description> </method> |