@series-inc/rundot-3d-engine 0.6.7 → 0.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -80
- package/dist/{chunk-SCNHMGS3.js → chunk-UDJVZHS6.js} +23 -1
- package/dist/{chunk-SCNHMGS3.js.map → chunk-UDJVZHS6.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/systems/index.d.ts +5 -0
- package/dist/systems/index.js +1 -1
- package/docs/systems/NavigationSystem.md +274 -274
- package/docs/systems/SplineSystem.md +270 -270
- package/package.json +95 -95
|
@@ -1,270 +1,270 @@
|
|
|
1
|
-
# Spline System
|
|
2
|
-
|
|
3
|
-
A flexible spline system for creating smooth curves through waypoints with debug visualization.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { SplineThree, SplineTypeThree } from "@series-inc/rundot-3d-engine/systems"
|
|
9
|
-
import * as THREE from "three"
|
|
10
|
-
|
|
11
|
-
// Create a spline
|
|
12
|
-
const spline = new SplineThree({
|
|
13
|
-
type: SplineTypeThree.CATMULL_ROM,
|
|
14
|
-
resolution: 10,
|
|
15
|
-
tension: 0.5,
|
|
16
|
-
closed: false,
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
// Set waypoints
|
|
20
|
-
spline.setWaypoints([
|
|
21
|
-
new THREE.Vector3(0, 0, 0),
|
|
22
|
-
new THREE.Vector3(10, 0, 5),
|
|
23
|
-
new THREE.Vector3(20, 0, 0),
|
|
24
|
-
new THREE.Vector3(30, 0, -10),
|
|
25
|
-
])
|
|
26
|
-
|
|
27
|
-
// Get positions along the spline
|
|
28
|
-
const startPos = spline.getPointAt(0) // t = 0 (start)
|
|
29
|
-
const midPos = spline.getPointAt(0.5) // t = 0.5 (middle)
|
|
30
|
-
const endPos = spline.getPointAt(1) // t = 1 (end)
|
|
31
|
-
|
|
32
|
-
// Get direction at a point
|
|
33
|
-
const direction = spline.getDirectionAt(0.5)
|
|
34
|
-
|
|
35
|
-
// Position and rotate a GameObject on the spline
|
|
36
|
-
spline.setGameObjectAt(myGameObject, 0.5)
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Spline Types
|
|
40
|
-
|
|
41
|
-
### Linear
|
|
42
|
-
|
|
43
|
-
Simple linear interpolation between waypoints.
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
const spline = new SplineThree({
|
|
47
|
-
type: SplineTypeThree.LINEAR,
|
|
48
|
-
resolution: 5,
|
|
49
|
-
})
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Catmull-Rom
|
|
53
|
-
|
|
54
|
-
Smooth curves that pass through all waypoints. Recommended for most use cases.
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
const spline = new SplineThree({
|
|
58
|
-
type: SplineTypeThree.CATMULL_ROM,
|
|
59
|
-
resolution: 10,
|
|
60
|
-
tension: 0.5, // 0 = loose curves, 1 = tight curves
|
|
61
|
-
})
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Bezier
|
|
65
|
-
|
|
66
|
-
Cubic Bezier curves with automatic control point generation.
|
|
67
|
-
|
|
68
|
-
```typescript
|
|
69
|
-
const spline = new SplineThree({
|
|
70
|
-
type: SplineTypeThree.BEZIER,
|
|
71
|
-
resolution: 12,
|
|
72
|
-
})
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Debug Visualization
|
|
76
|
-
|
|
77
|
-
### Per-Spline Debug
|
|
78
|
-
|
|
79
|
-
```typescript
|
|
80
|
-
// Enable debug on a spline
|
|
81
|
-
spline.enableDebug({
|
|
82
|
-
showWaypoints: true,
|
|
83
|
-
showCurve: true,
|
|
84
|
-
showDirection: true,
|
|
85
|
-
waypointColor: new THREE.Color(0xff0000),
|
|
86
|
-
curveColor: new THREE.Color(0x0000ff),
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
// Disable
|
|
90
|
-
spline.disableDebug()
|
|
91
|
-
|
|
92
|
-
// Check state
|
|
93
|
-
spline.isDebugEnabled()
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### SplineDebugRendererThree Component
|
|
97
|
-
|
|
98
|
-
A component for attaching debug visualization to a GameObject.
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
import { SplineDebugRendererThree } from "@series-inc/rundot-3d-engine/systems"
|
|
102
|
-
|
|
103
|
-
const debugRenderer = new SplineDebugRendererThree(spline, {
|
|
104
|
-
showWaypoints: true,
|
|
105
|
-
showCurve: true,
|
|
106
|
-
showDirection: true,
|
|
107
|
-
waypointSize: 0.5,
|
|
108
|
-
waypointColor: new THREE.Color(0xff0000),
|
|
109
|
-
curveColor: new THREE.Color(0x0000ff),
|
|
110
|
-
directionColor: new THREE.Color(0x00ff00),
|
|
111
|
-
directionLength: 1.0,
|
|
112
|
-
directionSpacing: 2.0,
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
const debugObject = new GameObject("SplineDebug")
|
|
116
|
-
debugObject.addComponent(debugRenderer)
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
#### Methods
|
|
120
|
-
|
|
121
|
-
- `refresh(): void` — manually refresh visualization
|
|
122
|
-
- `setShowWaypoints(show: boolean): void` — toggle waypoint display
|
|
123
|
-
- `setShowCurve(show: boolean): void` — toggle curve display
|
|
124
|
-
- `setShowDirection(show: boolean): void` — toggle direction arrows
|
|
125
|
-
|
|
126
|
-
### SplineDebugManager (Singleton)
|
|
127
|
-
|
|
128
|
-
Global manager for debug visualization across all splines.
|
|
129
|
-
|
|
130
|
-
```typescript
|
|
131
|
-
import { SplineDebugManager } from "@series-inc/rundot-3d-engine/systems"
|
|
132
|
-
|
|
133
|
-
const manager = SplineDebugManager.getInstance()
|
|
134
|
-
|
|
135
|
-
// Register splines for global debug
|
|
136
|
-
manager.registerSpline(spline, { showCurve: true })
|
|
137
|
-
manager.unregisterSpline(spline)
|
|
138
|
-
|
|
139
|
-
// Toggle all debug at once
|
|
140
|
-
manager.setDebugEnabled(true)
|
|
141
|
-
manager.isDebugEnabled()
|
|
142
|
-
|
|
143
|
-
// Configure defaults
|
|
144
|
-
manager.setDefaultConfig({ showWaypoints: true, showCurve: true })
|
|
145
|
-
|
|
146
|
-
// Query
|
|
147
|
-
manager.getRegisteredCount()
|
|
148
|
-
|
|
149
|
-
// Clear all
|
|
150
|
-
manager.clear()
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## API Reference
|
|
154
|
-
|
|
155
|
-
### SplineThree
|
|
156
|
-
|
|
157
|
-
#### Constructor
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
new SplineThree(config?: SplineConfigThree)
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Default config:
|
|
164
|
-
```typescript
|
|
165
|
-
{
|
|
166
|
-
type: SplineTypeThree.CATMULL_ROM,
|
|
167
|
-
resolution: 10,
|
|
168
|
-
tension: 0.5,
|
|
169
|
-
closed: false,
|
|
170
|
-
}
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
#### Waypoint Management
|
|
174
|
-
|
|
175
|
-
- `setWaypoints(waypoints: THREE.Vector3[]): void` — set all waypoints
|
|
176
|
-
- `getWaypoints(): THREE.Vector3[]` — get all waypoints
|
|
177
|
-
|
|
178
|
-
#### Point Sampling
|
|
179
|
-
|
|
180
|
-
- `getPointAt(t: number): THREE.Vector3` — get position at parameter t (0–1)
|
|
181
|
-
- `getDirectionAt(t: number): THREE.Vector3` — get direction (tangent) at parameter t
|
|
182
|
-
- `getPointAtDistance(distance: number): THREE.Vector3` — get position at a specific distance
|
|
183
|
-
- `getDirectionAtDistance(distance: number): THREE.Vector3` — get direction at a specific distance
|
|
184
|
-
|
|
185
|
-
#### Query Methods
|
|
186
|
-
|
|
187
|
-
- `getClosestPoint(position: THREE.Vector3): { point, t, distance }` — find closest point on spline
|
|
188
|
-
- `getTotalLength(): number` — get total spline length
|
|
189
|
-
- `getInterpolatedPoints(): THREE.Vector3[]` — get all interpolated points
|
|
190
|
-
- `getSegments(): SplineSegmentThree[]` — get segment data
|
|
191
|
-
|
|
192
|
-
#### GameObject Positioning
|
|
193
|
-
|
|
194
|
-
- `setGameObjectAt(gameObject: any, t: number): void` — position and rotate a GameObject on the spline
|
|
195
|
-
|
|
196
|
-
#### Debug
|
|
197
|
-
|
|
198
|
-
- `enableDebug(config?: SplineDebugConfig): void` — enable debug visualization
|
|
199
|
-
- `disableDebug(): void` — disable debug visualization
|
|
200
|
-
- `isDebugEnabled(): boolean` — check debug state
|
|
201
|
-
- `getDebugConfig(): SplineDebugConfig | undefined` — get current debug config
|
|
202
|
-
|
|
203
|
-
#### Cleanup
|
|
204
|
-
|
|
205
|
-
- `dispose(): void` — clean up resources
|
|
206
|
-
|
|
207
|
-
### SplineTypeThree Enum
|
|
208
|
-
|
|
209
|
-
```typescript
|
|
210
|
-
enum SplineTypeThree {
|
|
211
|
-
LINEAR = "linear",
|
|
212
|
-
CATMULL_ROM = "catmull_rom",
|
|
213
|
-
BEZIER = "bezier",
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### Interfaces
|
|
218
|
-
|
|
219
|
-
```typescript
|
|
220
|
-
interface SplineConfigThree {
|
|
221
|
-
type: SplineTypeThree
|
|
222
|
-
resolution: number
|
|
223
|
-
tension?: number // For Catmull-Rom (0–1)
|
|
224
|
-
closed?: boolean // Closed loop
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
interface SplinePointThree {
|
|
228
|
-
position: THREE.Vector3
|
|
229
|
-
index: number
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
interface SplineSegmentThree {
|
|
233
|
-
startPoint: SplinePointThree
|
|
234
|
-
endPoint: SplinePointThree
|
|
235
|
-
length: number
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
interface SplineDebugOptionsThree {
|
|
239
|
-
showWaypoints?: boolean
|
|
240
|
-
showCurve?: boolean
|
|
241
|
-
showDirection?: boolean
|
|
242
|
-
waypointSize?: number
|
|
243
|
-
waypointColor?: THREE.Color
|
|
244
|
-
curveColor?: THREE.Color
|
|
245
|
-
directionColor?: THREE.Color
|
|
246
|
-
directionLength?: number
|
|
247
|
-
directionSpacing?: number
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
interface SplineDebugConfig {
|
|
251
|
-
showWaypoints?: boolean
|
|
252
|
-
showCurve?: boolean
|
|
253
|
-
showDirection?: boolean
|
|
254
|
-
waypointSize?: number
|
|
255
|
-
waypointColor?: THREE.Color
|
|
256
|
-
curveColor?: THREE.Color
|
|
257
|
-
}
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
## Performance Notes
|
|
261
|
-
|
|
262
|
-
- Splines are regenerated when waypoints change
|
|
263
|
-
- Debug visualization creates mesh instances — disable when not needed
|
|
264
|
-
- Higher resolution values create smoother curves but use more memory
|
|
265
|
-
- Catmull-Rom splines are recommended for most use cases
|
|
266
|
-
|
|
267
|
-
## Related Systems
|
|
268
|
-
|
|
269
|
-
- [Component](../core/Component.md) - SplineDebugRendererThree is a component
|
|
270
|
-
- [GameObject](../core/GameObject.md) - Position GameObjects on splines
|
|
1
|
+
# Spline System
|
|
2
|
+
|
|
3
|
+
A flexible spline system for creating smooth curves through waypoints with debug visualization.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { SplineThree, SplineTypeThree } from "@series-inc/rundot-3d-engine/systems"
|
|
9
|
+
import * as THREE from "three"
|
|
10
|
+
|
|
11
|
+
// Create a spline
|
|
12
|
+
const spline = new SplineThree({
|
|
13
|
+
type: SplineTypeThree.CATMULL_ROM,
|
|
14
|
+
resolution: 10,
|
|
15
|
+
tension: 0.5,
|
|
16
|
+
closed: false,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
// Set waypoints
|
|
20
|
+
spline.setWaypoints([
|
|
21
|
+
new THREE.Vector3(0, 0, 0),
|
|
22
|
+
new THREE.Vector3(10, 0, 5),
|
|
23
|
+
new THREE.Vector3(20, 0, 0),
|
|
24
|
+
new THREE.Vector3(30, 0, -10),
|
|
25
|
+
])
|
|
26
|
+
|
|
27
|
+
// Get positions along the spline
|
|
28
|
+
const startPos = spline.getPointAt(0) // t = 0 (start)
|
|
29
|
+
const midPos = spline.getPointAt(0.5) // t = 0.5 (middle)
|
|
30
|
+
const endPos = spline.getPointAt(1) // t = 1 (end)
|
|
31
|
+
|
|
32
|
+
// Get direction at a point
|
|
33
|
+
const direction = spline.getDirectionAt(0.5)
|
|
34
|
+
|
|
35
|
+
// Position and rotate a GameObject on the spline
|
|
36
|
+
spline.setGameObjectAt(myGameObject, 0.5)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Spline Types
|
|
40
|
+
|
|
41
|
+
### Linear
|
|
42
|
+
|
|
43
|
+
Simple linear interpolation between waypoints.
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
const spline = new SplineThree({
|
|
47
|
+
type: SplineTypeThree.LINEAR,
|
|
48
|
+
resolution: 5,
|
|
49
|
+
})
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Catmull-Rom
|
|
53
|
+
|
|
54
|
+
Smooth curves that pass through all waypoints. Recommended for most use cases.
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
const spline = new SplineThree({
|
|
58
|
+
type: SplineTypeThree.CATMULL_ROM,
|
|
59
|
+
resolution: 10,
|
|
60
|
+
tension: 0.5, // 0 = loose curves, 1 = tight curves
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Bezier
|
|
65
|
+
|
|
66
|
+
Cubic Bezier curves with automatic control point generation.
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
const spline = new SplineThree({
|
|
70
|
+
type: SplineTypeThree.BEZIER,
|
|
71
|
+
resolution: 12,
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Debug Visualization
|
|
76
|
+
|
|
77
|
+
### Per-Spline Debug
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// Enable debug on a spline
|
|
81
|
+
spline.enableDebug({
|
|
82
|
+
showWaypoints: true,
|
|
83
|
+
showCurve: true,
|
|
84
|
+
showDirection: true,
|
|
85
|
+
waypointColor: new THREE.Color(0xff0000),
|
|
86
|
+
curveColor: new THREE.Color(0x0000ff),
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
// Disable
|
|
90
|
+
spline.disableDebug()
|
|
91
|
+
|
|
92
|
+
// Check state
|
|
93
|
+
spline.isDebugEnabled()
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### SplineDebugRendererThree Component
|
|
97
|
+
|
|
98
|
+
A component for attaching debug visualization to a GameObject.
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { SplineDebugRendererThree } from "@series-inc/rundot-3d-engine/systems"
|
|
102
|
+
|
|
103
|
+
const debugRenderer = new SplineDebugRendererThree(spline, {
|
|
104
|
+
showWaypoints: true,
|
|
105
|
+
showCurve: true,
|
|
106
|
+
showDirection: true,
|
|
107
|
+
waypointSize: 0.5,
|
|
108
|
+
waypointColor: new THREE.Color(0xff0000),
|
|
109
|
+
curveColor: new THREE.Color(0x0000ff),
|
|
110
|
+
directionColor: new THREE.Color(0x00ff00),
|
|
111
|
+
directionLength: 1.0,
|
|
112
|
+
directionSpacing: 2.0,
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
const debugObject = new GameObject("SplineDebug")
|
|
116
|
+
debugObject.addComponent(debugRenderer)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### Methods
|
|
120
|
+
|
|
121
|
+
- `refresh(): void` — manually refresh visualization
|
|
122
|
+
- `setShowWaypoints(show: boolean): void` — toggle waypoint display
|
|
123
|
+
- `setShowCurve(show: boolean): void` — toggle curve display
|
|
124
|
+
- `setShowDirection(show: boolean): void` — toggle direction arrows
|
|
125
|
+
|
|
126
|
+
### SplineDebugManager (Singleton)
|
|
127
|
+
|
|
128
|
+
Global manager for debug visualization across all splines.
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { SplineDebugManager } from "@series-inc/rundot-3d-engine/systems"
|
|
132
|
+
|
|
133
|
+
const manager = SplineDebugManager.getInstance()
|
|
134
|
+
|
|
135
|
+
// Register splines for global debug
|
|
136
|
+
manager.registerSpline(spline, { showCurve: true })
|
|
137
|
+
manager.unregisterSpline(spline)
|
|
138
|
+
|
|
139
|
+
// Toggle all debug at once
|
|
140
|
+
manager.setDebugEnabled(true)
|
|
141
|
+
manager.isDebugEnabled()
|
|
142
|
+
|
|
143
|
+
// Configure defaults
|
|
144
|
+
manager.setDefaultConfig({ showWaypoints: true, showCurve: true })
|
|
145
|
+
|
|
146
|
+
// Query
|
|
147
|
+
manager.getRegisteredCount()
|
|
148
|
+
|
|
149
|
+
// Clear all
|
|
150
|
+
manager.clear()
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## API Reference
|
|
154
|
+
|
|
155
|
+
### SplineThree
|
|
156
|
+
|
|
157
|
+
#### Constructor
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
new SplineThree(config?: SplineConfigThree)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Default config:
|
|
164
|
+
```typescript
|
|
165
|
+
{
|
|
166
|
+
type: SplineTypeThree.CATMULL_ROM,
|
|
167
|
+
resolution: 10,
|
|
168
|
+
tension: 0.5,
|
|
169
|
+
closed: false,
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Waypoint Management
|
|
174
|
+
|
|
175
|
+
- `setWaypoints(waypoints: THREE.Vector3[]): void` — set all waypoints
|
|
176
|
+
- `getWaypoints(): THREE.Vector3[]` — get all waypoints
|
|
177
|
+
|
|
178
|
+
#### Point Sampling
|
|
179
|
+
|
|
180
|
+
- `getPointAt(t: number): THREE.Vector3` — get position at parameter t (0–1)
|
|
181
|
+
- `getDirectionAt(t: number): THREE.Vector3` — get direction (tangent) at parameter t
|
|
182
|
+
- `getPointAtDistance(distance: number): THREE.Vector3` — get position at a specific distance
|
|
183
|
+
- `getDirectionAtDistance(distance: number): THREE.Vector3` — get direction at a specific distance
|
|
184
|
+
|
|
185
|
+
#### Query Methods
|
|
186
|
+
|
|
187
|
+
- `getClosestPoint(position: THREE.Vector3): { point, t, distance }` — find closest point on spline
|
|
188
|
+
- `getTotalLength(): number` — get total spline length
|
|
189
|
+
- `getInterpolatedPoints(): THREE.Vector3[]` — get all interpolated points
|
|
190
|
+
- `getSegments(): SplineSegmentThree[]` — get segment data
|
|
191
|
+
|
|
192
|
+
#### GameObject Positioning
|
|
193
|
+
|
|
194
|
+
- `setGameObjectAt(gameObject: any, t: number): void` — position and rotate a GameObject on the spline
|
|
195
|
+
|
|
196
|
+
#### Debug
|
|
197
|
+
|
|
198
|
+
- `enableDebug(config?: SplineDebugConfig): void` — enable debug visualization
|
|
199
|
+
- `disableDebug(): void` — disable debug visualization
|
|
200
|
+
- `isDebugEnabled(): boolean` — check debug state
|
|
201
|
+
- `getDebugConfig(): SplineDebugConfig | undefined` — get current debug config
|
|
202
|
+
|
|
203
|
+
#### Cleanup
|
|
204
|
+
|
|
205
|
+
- `dispose(): void` — clean up resources
|
|
206
|
+
|
|
207
|
+
### SplineTypeThree Enum
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
enum SplineTypeThree {
|
|
211
|
+
LINEAR = "linear",
|
|
212
|
+
CATMULL_ROM = "catmull_rom",
|
|
213
|
+
BEZIER = "bezier",
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Interfaces
|
|
218
|
+
|
|
219
|
+
```typescript
|
|
220
|
+
interface SplineConfigThree {
|
|
221
|
+
type: SplineTypeThree
|
|
222
|
+
resolution: number
|
|
223
|
+
tension?: number // For Catmull-Rom (0–1)
|
|
224
|
+
closed?: boolean // Closed loop
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
interface SplinePointThree {
|
|
228
|
+
position: THREE.Vector3
|
|
229
|
+
index: number
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
interface SplineSegmentThree {
|
|
233
|
+
startPoint: SplinePointThree
|
|
234
|
+
endPoint: SplinePointThree
|
|
235
|
+
length: number
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface SplineDebugOptionsThree {
|
|
239
|
+
showWaypoints?: boolean
|
|
240
|
+
showCurve?: boolean
|
|
241
|
+
showDirection?: boolean
|
|
242
|
+
waypointSize?: number
|
|
243
|
+
waypointColor?: THREE.Color
|
|
244
|
+
curveColor?: THREE.Color
|
|
245
|
+
directionColor?: THREE.Color
|
|
246
|
+
directionLength?: number
|
|
247
|
+
directionSpacing?: number
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
interface SplineDebugConfig {
|
|
251
|
+
showWaypoints?: boolean
|
|
252
|
+
showCurve?: boolean
|
|
253
|
+
showDirection?: boolean
|
|
254
|
+
waypointSize?: number
|
|
255
|
+
waypointColor?: THREE.Color
|
|
256
|
+
curveColor?: THREE.Color
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Performance Notes
|
|
261
|
+
|
|
262
|
+
- Splines are regenerated when waypoints change
|
|
263
|
+
- Debug visualization creates mesh instances — disable when not needed
|
|
264
|
+
- Higher resolution values create smoother curves but use more memory
|
|
265
|
+
- Catmull-Rom splines are recommended for most use cases
|
|
266
|
+
|
|
267
|
+
## Related Systems
|
|
268
|
+
|
|
269
|
+
- [Component](../core/Component.md) - SplineDebugRendererThree is a component
|
|
270
|
+
- [GameObject](../core/GameObject.md) - Position GameObjects on splines
|