diff options
author | Yaohua Xiong <xiongyaohua@gmail.com> | 2022-08-07 18:29:12 +0800 |
---|---|---|
committer | Yaohua Xiong <xiongyaohua@gmail.com> | 2022-11-12 12:03:54 +0800 |
commit | 5241464a462d4f7ab00ccf8cb4b59f4547fe6639 (patch) | |
tree | a5d5376603757fccf7b8854bb5d0ca5b5463902d /doc/classes | |
parent | 6521eccaaec2f8dd87373ee15a1fb0d889aef1fd (diff) |
Refactor Curv3D and PathFollow3D
This commit makes the following major changes
1. Add "sample_baked_with_rotation()" to Curve3D, making it usable independently. A similar change was made to Curve2D previously.
2. Refactor the _bake() method on Curve3D, using Parallel Transport Frame instead of Frenet Frame.
3. Refactor the sample_* methods, including:
i. Factor out common binary search code, following the DRY principe
ii. sample_up_vector() interpolated up vector as part of rotation frame(posture) for consistancy and accuracy.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/Curve3D.xml | 9 | ||||
-rw-r--r-- | doc/classes/PathFollow3D.xml | 13 |
2 files changed, 22 insertions, 0 deletions
diff --git a/doc/classes/Curve3D.xml b/doc/classes/Curve3D.xml index 3e4e05f51a..63134417b1 100644 --- a/doc/classes/Curve3D.xml +++ b/doc/classes/Curve3D.xml @@ -132,6 +132,15 @@ If the curve has no up vectors, the function sends an error to the console, and returns [code](0, 1, 0)[/code]. </description> </method> + <method name="sample_baked_with_rotation" qualifiers="const"> + <return type="Transform3D" /> + <param index="0" name="offset" type="float" /> + <param index="1" name="cubic" type="bool" default="false" /> + <param index="2" name="apply_tilt" type="bool" default="false" /> + <description> + Similar with [code]interpolate_baked()[/code]. The the return value is [code]Transform3D[/code], with [code]origin[/code] as point position, [code]basis.x[/code] as sideway vector, [code]basis.y[/code] as up vector, [code]basis.z[/code] as forward vector. When the curve length is 0, there is no reasonable way to caculate the rotation, all vectors aligned with global space axes. + </description> + </method> <method name="samplef" qualifiers="const"> <return type="Vector3" /> <param index="0" name="fofs" type="float" /> diff --git a/doc/classes/PathFollow3D.xml b/doc/classes/PathFollow3D.xml index ba7207be8f..fa7580b7b6 100644 --- a/doc/classes/PathFollow3D.xml +++ b/doc/classes/PathFollow3D.xml @@ -9,6 +9,16 @@ </description> <tutorials> </tutorials> + <methods> + <method name="correct_posture" qualifiers="static"> + <return type="Transform3D" /> + <param index="0" name="transform" type="Transform3D" /> + <param index="1" name="rotation_mode" type="int" enum="PathFollow3D.RotationMode" /> + <description> + Correct the [code]transform[/code]. [code]rotation_mode[/code] implicitly specifies how posture (forward, up and sideway direction) is caculated. + </description> + </method> + </methods> <members> <member name="cubic_interp" type="bool" setter="set_cubic_interpolation" getter="get_cubic_interpolation" default="true"> If [code]true[/code], the position between two cached points is interpolated cubically, and linearly otherwise. @@ -30,6 +40,9 @@ <member name="rotation_mode" type="int" setter="set_rotation_mode" getter="get_rotation_mode" enum="PathFollow3D.RotationMode" default="3"> Allows or forbids rotation on one or more axes, depending on the [enum RotationMode] constants being used. </member> + <member name="tilt_enabled" type="bool" setter="set_tilt_enabled" getter="is_tilt_enabled" default="true"> + If [code]true[/code], the tilt property of [Curve3D] takes effect. + </member> <member name="v_offset" type="float" setter="set_v_offset" getter="get_v_offset" default="0.0"> The node's offset perpendicular to the curve. </member> |