40 const BitMask_t nodeflags = RigDef::Node::Ref::REGULAR_STATE_IS_VALID;
72 if (beam_defaults->springiness != b_spring
73 || beam_defaults->damping_constant != b_damp
74 || beam_defaults->deformation_threshold != b_deform
75 || beam_defaults->breaking_threshold != b_break
76 || beam_defaults->visual_beam_diameter != b_diameter)
78 beam_defaults = std::shared_ptr<BeamDefaults>(
new BeamDefaults);
79 beam_defaults->springiness = b_spring;
80 beam_defaults->damping_constant = b_damp;
81 beam_defaults->deformation_threshold = b_deform;
82 beam_defaults->breaking_threshold = b_break;
83 beam_defaults->visual_beam_diameter = b_diameter;
93 if (node_defaults->load_weight != n_loadweight
94 || node_defaults->friction != n_friction
95 || node_defaults->surface != n_surface
96 || node_defaults->volume != n_volume)
98 node_defaults = std::shared_ptr<NodeDefaults>(
new NodeDefaults);
99 node_defaults->load_weight = n_loadweight;
100 node_defaults->friction = n_friction;
101 node_defaults->surface = n_surface;
102 node_defaults->volume = n_volume;
113 if (inertia_defaults->start_delay_factor != start_delay
114 || inertia_defaults->stop_delay_factor != stop_delay
115 || inertia_defaults->start_function != startfn
116 || inertia_defaults->stop_function != stopfn
119 inertia_defaults = std::shared_ptr<Inertia>(
new Inertia);
120 inertia_defaults->start_delay_factor = start_delay;
121 inertia_defaults->stop_delay_factor = stop_delay;
122 inertia_defaults->start_function = startfn;
123 inertia_defaults->stop_function = stopfn;
140 m_used_actor_entry->actor_def->root_module->nodes.clear();
141 m_used_actor_entry->actor_def->root_module->beams.clear();
142 m_used_actor_entry->actor_def->root_module->cinecam.clear();
143 m_used_actor_entry->actor_def->root_module->wheels.clear();
144 m_used_actor_entry->actor_def->root_module->wheels2.clear();
145 m_used_actor_entry->actor_def->root_module->meshwheels.clear();
146 m_used_actor_entry->actor_def->root_module->meshwheels2.clear();
147 m_used_actor_entry->actor_def->root_module->flexbodywheels.clear();
148 m_used_actor_entry->actor_def->root_module->shocks.clear();
149 m_used_actor_entry->actor_def->root_module->shocks2.clear();
150 m_used_actor_entry->actor_def->root_module->shocks3.clear();
151 m_used_actor_entry->actor_def->root_module->hydros.clear();
154 auto node_defaults = std::shared_ptr<NodeDefaults>(
new NodeDefaults);
157 auto default_minimass = std::shared_ptr<DefaultMinimass>(
new DefaultMinimass());
161 auto beam_defaults = std::shared_ptr<BeamDefaults>(
new BeamDefaults);
164 beam_defaults->deformation_threshold =
BEAM_DEFORM;
165 beam_defaults->breaking_threshold =
BEAM_BREAK;
169 auto inertia_defaults = std::shared_ptr<Inertia>(
new Inertia);
177 for (
NodeNum_t i = 0; i < ar_num_nodes; i++)
179 if (ar_nodes[i].nd_rim_node || ar_nodes[i].nd_tyre_node || ar_nodes[i].nd_cinecam_node)
188 if (default_minimass->min_mass_Kg != ar_minimass[i])
190 default_minimass = std::shared_ptr<DefaultMinimass>(
new DefaultMinimass());
191 default_minimass->min_mass_Kg = ar_minimass[i];
200 if (ar_nodes_name[i] !=
"")
208 node.
position = ar_nodes_spawn_offsets[i];
211 node.
options = ar_nodes_options[i];
214 m_used_actor_entry->actor_def->root_module->nodes.push_back(node);
220 for (
int i = 0; i < ar_num_beams; i++)
222 if (!ar_beams_user_defined[i])
231 if (detacher_group != ar_beams[i].detacher_group)
233 detacher_group = ar_beams[i].detacher_group;
247 else if (ar_beams[i].bounded ==
ROPE)
252 if (ar_beams_invisible[i])
262 m_used_actor_entry->actor_def->root_module->beams.push_back(beam);
268 for (
NodeNum_t i = 0; i < ar_num_nodes; i++)
270 if (!ar_nodes[i].nd_cinecam_node)
279 std::array<int, 8> cinecam_nodes = { -1, -1, -1, -1, -1, -1, -1, -1 };
280 int num_cinecam_nodes = 0;
281 int cinecam_beamid = -1;
282 for (
int j = 0; j < ar_num_beams; j++)
284 if (ar_beams[j].p1->pos == i)
287 cinecam_nodes[num_cinecam_nodes++] = ar_beams[j].p2->pos;
289 else if (ar_beams[j].p2->pos == i)
292 cinecam_nodes[num_cinecam_nodes++] = ar_beams[j].p1->pos;
304 cinecam.
position = ar_nodes_spawn_offsets[i];
305 for (
int n = 0; n < 8; n++)
310 cinecam.
spring = ar_beams[cinecam_beamid].k;
311 cinecam.
damping = ar_beams[cinecam_beamid].d;
314 m_used_actor_entry->actor_def->root_module->cinecam.push_back(cinecam);
319 for (
int i = 0; i < ar_num_wheels; i++)
325 switch (ar_wheels[i].wh_arg_keyword)
327 case Keyword::WHEELS:
333 wheel.
radius = ar_wheels[i].wh_radius;
335 wheel.
num_rays = ar_wheels[i].wh_arg_num_rays;
341 wheel.
braking = ar_wheels[i].wh_braking;
346 wheel.
mass = ar_wheels[i].wh_mass;
348 wheel.
springiness = ar_beams[ar_wheels[i].wh_beam_start].k;
349 wheel.
damping = ar_beams[ar_wheels[i].wh_beam_start].d;
354 m_used_actor_entry->actor_def->root_module->wheels.push_back(wheel);
357 case Keyword::WHEELS2:
363 wheel.
rim_radius = ar_wheels[i].wh_rim_radius;
366 wheel.
num_rays = ar_wheels[i].wh_arg_num_rays;
372 wheel.
braking = ar_wheels[i].wh_braking;
377 wheel.
mass = ar_wheels[i].wh_mass;
380 wheel.
rim_damping = ar_wheels[i].wh_arg_rim_damping;
382 wheel.
tyre_damping = ar_beams[ar_wheels[i].wh_beam_start].d;
387 m_used_actor_entry->actor_def->root_module->wheels2.push_back(wheel);
390 case Keyword::MESHWHEELS:
396 wheel.
rim_radius = ar_wheels[i].wh_rim_radius;
399 wheel.
num_rays = ar_wheels[i].wh_arg_num_rays;
405 wheel.
braking = ar_wheels[i].wh_braking;
410 wheel.
mass = ar_wheels[i].wh_mass;
412 wheel.
spring = ar_beams[ar_wheels[i].wh_beam_start].k;
413 wheel.
damping = ar_beams[ar_wheels[i].wh_beam_start].d;
415 wheel.
side = ar_wheels[i].wh_arg_side;
416 wheel.
mesh_name = ar_wheels[i].wh_arg_media1;
419 m_used_actor_entry->actor_def->root_module->meshwheels.push_back(wheel);
422 case Keyword::MESHWHEELS2:
428 wheel.
beam_defaults->springiness = ar_wheels[i].wh_arg_rim_spring;
429 wheel.
beam_defaults->damping_constant = ar_wheels[i].wh_arg_rim_damping;
432 wheel.
rim_radius = ar_wheels[i].wh_rim_radius;
435 wheel.
num_rays = ar_wheels[i].wh_arg_num_rays;
441 wheel.
braking = ar_wheels[i].wh_braking;
446 wheel.
mass = ar_wheels[i].wh_mass;
448 wheel.
spring = ar_beams[ar_wheels[i].wh_beam_start].k;
449 wheel.
damping = ar_beams[ar_wheels[i].wh_beam_start].d;
451 wheel.
side = ar_wheels[i].wh_arg_side;
452 wheel.
mesh_name = ar_wheels[i].wh_arg_media1;
455 m_used_actor_entry->actor_def->root_module->meshwheels2.push_back(wheel);
458 case Keyword::FLEXBODYWHEELS:
464 wheel.
beam_defaults->springiness = ar_wheels[i].wh_arg_rim_spring;
465 wheel.
beam_defaults->damping_constant = ar_wheels[i].wh_arg_rim_damping;
468 wheel.
rim_radius = ar_wheels[i].wh_rim_radius;
471 wheel.
num_rays = ar_wheels[i].wh_arg_num_rays;
477 wheel.
braking = ar_wheels[i].wh_braking;
482 wheel.
mass = ar_wheels[i].wh_mass;
485 wheel.
rim_damping = ar_beams[ar_wheels[i].wh_beam_start].d;
487 wheel.
side = ar_wheels[i].wh_arg_side;
491 m_used_actor_entry->actor_def->root_module->flexbodywheels.push_back(wheel);
502 for (
int i = 0; i < ar_num_beams; i++)
504 const beam_t& beam = ar_beams[i];
538 if (ar_beams_invisible[i])
543 m_used_actor_entry->actor_def->root_module->shocks.push_back(def);
572 if (ar_beams_invisible[i])
577 m_used_actor_entry->actor_def->root_module->shocks2.push_back(def);
610 if (ar_beams_invisible[i])
615 m_used_actor_entry->actor_def->root_module->shocks3.push_back(def);
627 int i = hydrobeam.hb_beam_index;
628 const beam_t& beam = ar_beams[i];
651 if (ar_beams_invisible[i])
690 m_used_actor_entry->actor_def->root_module->hydros.push_back(def);
695 m_used_actor_entry->actor_def->root_module->globals[0].dry_mass = ar_dry_mass;
696 m_used_actor_entry->actor_def->root_module->globals[0].cargo_mass = ar_load_mass;