@@ -162,6 +162,24 @@ void MMTrajectoryFeature::display_data(const Ref<EditorNode3DGizmo>& p_gizmo, co
162
162
delete[] dernomalized_data;
163
163
}
164
164
165
+ float MMTrajectoryFeature::calculate_normalized_weight (int64_t p_feature_dim) const {
166
+
167
+ float weight = MMFeature::calculate_normalized_weight (p_feature_dim);
168
+
169
+ const uint32_t point_dim = _get_point_dimension_count ();
170
+
171
+ const bool is_height = include_height && (p_feature_dim % point_dim) == 2 ;
172
+ const bool is_facing = include_facing && (p_feature_dim % point_dim) == (include_height ? 3 : 2 );
173
+
174
+ if (is_height) {
175
+ weight *= height_weight;
176
+ } else if (is_facing) {
177
+ weight *= facing_weight;
178
+ }
179
+
180
+ return weight;
181
+ }
182
+
165
183
TypedArray<Dictionary> MMTrajectoryFeature::get_trajectory_points (const Transform3D& p_character_transform, const PackedFloat32Array& p_trajectory_data) const {
166
184
ERR_FAIL_COND_V (p_trajectory_data.is_empty (), TypedArray<Dictionary>());
167
185
@@ -189,14 +207,48 @@ TypedArray<Dictionary> MMTrajectoryFeature::get_trajectory_points(const Transfor
189
207
return result;
190
208
}
191
209
210
+ bool MMTrajectoryFeature::get_include_height () const {
211
+ return include_height;
212
+ }
213
+
214
+ void MMTrajectoryFeature::set_include_height (bool value) {
215
+ include_height = value;
216
+ notify_property_list_changed ();
217
+ }
218
+
219
+ bool MMTrajectoryFeature::get_include_facing () const {
220
+ return include_facing;
221
+ }
222
+
223
+ void MMTrajectoryFeature::set_include_facing (bool value) {
224
+ include_facing = value;
225
+ notify_property_list_changed ();
226
+ }
227
+
228
+ void MMTrajectoryFeature::_validate_property (PropertyInfo& p_property) const {
229
+ if (p_property.name == StringName (" facing_weight" )) {
230
+ if (!include_facing) {
231
+ p_property.usage = PROPERTY_USAGE_NO_EDITOR;
232
+ }
233
+ }
234
+
235
+ if (p_property.name == StringName (" height_weight" )) {
236
+ if (!include_height) {
237
+ p_property.usage = PROPERTY_USAGE_NO_EDITOR;
238
+ }
239
+ }
240
+ }
241
+
192
242
void MMTrajectoryFeature::_bind_methods () {
193
243
ClassDB::bind_method (D_METHOD (" get_trajectory_points" , " character_transform" , " trajectory_data" ), &MMTrajectoryFeature::get_trajectory_points);
194
244
BINDER_PROPERTY_PARAMS (MMTrajectoryFeature, Variant::FLOAT, past_delta_time);
195
245
BINDER_PROPERTY_PARAMS (MMTrajectoryFeature, Variant::INT, past_frames);
196
246
BINDER_PROPERTY_PARAMS (MMTrajectoryFeature, Variant::FLOAT, future_delta_time);
197
247
BINDER_PROPERTY_PARAMS (MMTrajectoryFeature, Variant::INT, future_frames);
198
248
BINDER_PROPERTY_PARAMS (MMTrajectoryFeature, Variant::BOOL, include_height);
249
+ BINDER_PROPERTY_PARAMS (MMTrajectoryFeature, Variant::FLOAT, height_weight);
199
250
BINDER_PROPERTY_PARAMS (MMTrajectoryFeature, Variant::BOOL, include_facing);
251
+ BINDER_PROPERTY_PARAMS (MMTrajectoryFeature, Variant::FLOAT, facing_weight);
200
252
}
201
253
202
254
uint32_t MMTrajectoryFeature::_get_point_dimension_count () const {
0 commit comments