summaryrefslogtreecommitdiff
path: root/doc/classes/PathFollow.xml
blob: 86f55a2aaf23809742d0e6ef527b1d5e232c72f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?xml version="1.0" encoding="UTF-8" ?>
<class name="PathFollow" inherits="Spatial" category="Core" version="3.0.alpha.custom_build">
	<brief_description>
		Point sampler for a [Path].
	</brief_description>
	<description>
		This node takes its parent [Path], and returns the coordinates of a point within it, given a distance from the first vertex.
		It is useful for making other nodes follow a path, without coding the movement pattern. For that, the nodes must be descendants of this node. Then, when setting an offset in this node, the descendant nodes will move accordingly.
	</description>
	<tutorials>
	</tutorials>
	<demos>
	</demos>
	<methods>
		<method name="get_cubic_interpolation" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				This method returns whether the position between two cached points (see [method set_cubic_interpolation]) is interpolated linearly, or cubicly.
			</description>
		</method>
		<method name="get_h_offset" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the X displacement this node has from its parent [Path].
			</description>
		</method>
		<method name="get_offset" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the distance along the path in 3D units.
			</description>
		</method>
		<method name="get_rotation_mode" qualifiers="const">
			<return type="int" enum="PathFollow.RotationMode">
			</return>
			<description>
				Returns the rotation mode. The constants below list which axes are allowed to rotate for each mode.
			</description>
		</method>
		<method name="get_unit_offset" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the distance along the path as a number in the range 0.0 (for the first vertex) to 1.0 (for the last).
			</description>
		</method>
		<method name="get_v_offset" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the Y displacement this node has from its parent [Path].
			</description>
		</method>
		<method name="has_loop" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Returns whether this node wraps its offsets around, or truncates them to the path ends.
			</description>
		</method>
		<method name="set_cubic_interpolation">
			<return type="void">
			</return>
			<argument index="0" name="enable" type="bool">
			</argument>
			<description>
				The points along the [Curve3D] of the [Path] are precomputed before use, for faster calculations. The point at the requested offset is then calculated interpolating between two adjacent cached points. This may present a problem if the curve makes sharp turns, as the cached points may not follow the curve closely enough.
				There are two answers to this problem: Either increase the number of cached points and increase memory consumption, or make a cubic interpolation between two points at the cost of (slightly) slower calculations.
				This method controls whether the position between two cached points is interpolated linearly, or cubicly.
			</description>
		</method>
		<method name="set_h_offset">
			<return type="void">
			</return>
			<argument index="0" name="h_offset" type="float">
			</argument>
			<description>
				Moves this node in the X axis. As this node's position will be set every time its offset is set, this allows many PathFollow to share the same curve (and thus the same movement pattern), yet not return the same position for a given path offset.
				A similar effect may be achieved moving the this node's descendants.
			</description>
		</method>
		<method name="set_loop">
			<return type="void">
			</return>
			<argument index="0" name="loop" type="bool">
			</argument>
			<description>
				If set, any offset outside the path's length (whether set by [method set_offset] or [method set_unit_offset] will wrap around, instead of stopping at the ends. Set it for cyclic paths.
			</description>
		</method>
		<method name="set_offset">
			<return type="void">
			</return>
			<argument index="0" name="offset" type="float">
			</argument>
			<description>
				Sets the distance from the first vertex, measured in 3D units along the path. This sets this node's position to a point within the path.
			</description>
		</method>
		<method name="set_rotation_mode">
			<return type="void">
			</return>
			<argument index="0" name="rotation_mode" type="int" enum="PathFollow.RotationMode">
			</argument>
			<description>
				Allows or forbids rotation on one or more axes, per the constants below.
			</description>
		</method>
		<method name="set_unit_offset">
			<return type="void">
			</return>
			<argument index="0" name="unit_offset" type="float">
			</argument>
			<description>
				Sets the distance from the first vertex, considering 0.0 as the first vertex and 1.0 as the last. This is just another way of expressing the offset within the path, as the offset supplied is multiplied internally by the path's length.
			</description>
		</method>
		<method name="set_v_offset">
			<return type="void">
			</return>
			<argument index="0" name="v_offset" type="float">
			</argument>
			<description>
				Moves this node in the Y axis, for the same reasons of [method set_h_offset].
			</description>
		</method>
	</methods>
	<constants>
		<constant name="ROTATION_NONE" value="0">
			Forbids the PathFollow to rotate.
		</constant>
		<constant name="ROTATION_Y" value="1">
			Allows the PathFollow to rotate in the Y axis only.
		</constant>
		<constant name="ROTATION_XY" value="2">
			Allows the PathFollow to rotate in both the X, and Y axes.
		</constant>
		<constant name="ROTATION_XYZ" value="3">
			Allows the PathFollow to rotate in any axis.
		</constant>
	</constants>
</class>