PhysicsResource.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. /*
  2. Copyright (c) 2013 Daniele Bartolini, Michele Rossi
  3. Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto
  4. Permission is hereby granted, free of charge, to any person
  5. obtaining a copy of this software and associated documentation
  6. files (the "Software"), to deal in the Software without
  7. restriction, including without limitation the rights to use,
  8. copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. copies of the Software, and to permit persons to whom the
  10. Software is furnished to do so, subject to the following
  11. conditions:
  12. The above copyright notice and this permission notice shall be
  13. included in all copies or substantial portions of the Software.
  14. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  15. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  16. OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  17. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  18. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  19. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  21. OTHER DEALINGS IN THE SOFTWARE.
  22. */
  23. #include <algorithm>
  24. #include "Allocator.h"
  25. #include "Filesystem.h"
  26. #include "Hash.h"
  27. #include "JSONParser.h"
  28. #include "PhysicsResource.h"
  29. #include "StringUtils.h"
  30. #include "DynamicString.h"
  31. namespace crown
  32. {
  33. namespace physics_resource
  34. {
  35. //-----------------------------------------------------------------------------
  36. static uint32_t shape_type_to_enum(const char* type)
  37. {
  38. if (string::strcmp("sphere", type) == 0) return PhysicsShapeType::SPHERE;
  39. else if (string::strcmp("capsule", type) == 0) return PhysicsShapeType::CAPSULE;
  40. else if (string::strcmp("box", type) == 0) return PhysicsShapeType::BOX;
  41. else if (string::strcmp("plane", type) == 0) return PhysicsShapeType::PLANE;
  42. CE_FATAL("Bad shape type");
  43. return 0;
  44. }
  45. //-----------------------------------------------------------------------------
  46. static uint32_t joint_type_to_enum(const char* type)
  47. {
  48. if (string::strcmp("fixed", type) == 0) return PhysicsJointType::FIXED;
  49. else if (string::strcmp("spherical", type) == 0) return PhysicsJointType::SPHERICAL;
  50. else if (string::strcmp("revolute", type) == 0) return PhysicsJointType::REVOLUTE;
  51. else if (string::strcmp("prismatic", type) == 0) return PhysicsJointType::PRISMATIC;
  52. else if (string::strcmp("distance", type) == 0) return PhysicsJointType::DISTANCE;
  53. else if (string::strcmp("d6", type) == 0) return PhysicsJointType::D6;
  54. CE_FATAL("Bad joint type");
  55. return 0;
  56. }
  57. //-----------------------------------------------------------------------------
  58. void parse_controller(JSONElement e, PhysicsController& controller)
  59. {
  60. JSONElement name = e.key("name");
  61. JSONElement height = e.key("height");
  62. JSONElement radius = e.key("radius");
  63. JSONElement slope_limit = e.key("slope_limit");
  64. JSONElement step_offset = e.key("step_offset");
  65. JSONElement contact_offset = e.key("contact_offset");
  66. JSONElement collision_filter = e.key("collision_filter");
  67. controller.name = name.string_id_value();
  68. controller.height = height.float_value();
  69. controller.radius = radius.float_value();
  70. controller.slope_limit = slope_limit.float_value();
  71. controller.step_offset = step_offset.float_value();
  72. controller.contact_offset = contact_offset.float_value();
  73. controller.collision_filter = collision_filter.string_id_value();
  74. }
  75. //-----------------------------------------------------------------------------
  76. void parse_shapes(JSONElement e, List<PhysicsShape>& shapes)
  77. {
  78. Vector<DynamicString> keys(default_allocator());
  79. e.key_value(keys);
  80. for (uint32_t k = 0; k < keys.size(); k++)
  81. {
  82. JSONElement shape = e.key(keys[k].c_str());
  83. JSONElement clasz = shape.key("class");
  84. JSONElement type = shape.key("type");
  85. JSONElement material = shape.key("material");
  86. PhysicsShape ps;
  87. ps.name = keys[k].to_string_id();
  88. ps.shape_class = clasz.string_id_value();
  89. ps.material = material.string_id_value();
  90. DynamicString stype; type.string_value(stype);
  91. ps.type = shape_type_to_enum(stype.c_str());
  92. switch (ps.type)
  93. {
  94. case PhysicsShapeType::SPHERE:
  95. {
  96. JSONElement radius = shape.key("radius");
  97. ps.data_0 = radius.float_value();
  98. break;
  99. }
  100. case PhysicsShapeType::CAPSULE:
  101. {
  102. // TODO
  103. break;
  104. }
  105. case PhysicsShapeType::BOX:
  106. {
  107. JSONElement half_x = shape.key("half_x");
  108. JSONElement half_y = shape.key("half_y");
  109. JSONElement half_z = shape.key("half_z");
  110. ps.data_0 = half_x.float_value();
  111. ps.data_1 = half_y.float_value();
  112. ps.data_2 = half_z.float_value();
  113. break;
  114. }
  115. case PhysicsShapeType::PLANE:
  116. {
  117. // TODO
  118. break;
  119. }
  120. }
  121. shapes.push_back(ps);
  122. }
  123. }
  124. //-----------------------------------------------------------------------------
  125. void parse_actors(JSONElement e, List<PhysicsActor>& actors, List<PhysicsShape>& actor_shapes, List<uint32_t>& shape_indices)
  126. {
  127. Vector<DynamicString> keys(default_allocator());
  128. e.key_value(keys);
  129. for (uint32_t k = 0; k < keys.size(); k++)
  130. {
  131. JSONElement actor = e.key(keys[k].c_str());
  132. JSONElement node = actor.key("node");
  133. JSONElement clasz = actor.key("class");
  134. JSONElement shapes = actor.key("shapes");
  135. PhysicsActor pa;
  136. pa.name = keys[k].to_string_id();
  137. pa.node = node.string_id_value();
  138. pa.actor_class = clasz.string_id_value();
  139. pa.num_shapes = shapes.size();
  140. actors.push_back(pa);
  141. shape_indices.push_back(shape_indices.size());
  142. parse_shapes(shapes, actor_shapes);
  143. }
  144. }
  145. //-----------------------------------------------------------------------------
  146. void parse_joints(JSONElement e, List<PhysicsJoint>& joints)
  147. {
  148. Vector<DynamicString> keys(default_allocator());
  149. e.key_value(keys);
  150. for (uint32_t k = 0; k < keys.size(); k++)
  151. {
  152. JSONElement joint = e.key(keys[k].c_str());
  153. JSONElement type = joint.key("type");
  154. JSONElement actor_0 = joint.key("actor_0");
  155. JSONElement actor_1 = joint.key("actor_1");
  156. JSONElement anchor_0 = joint.key("anchor_0");
  157. JSONElement anchor_1 = joint.key("anchor_1");
  158. JSONElement restitution = joint.key_or_nil("restitution");
  159. JSONElement spring = joint.key_or_nil("spring");
  160. JSONElement damping = joint.key_or_nil("damping");
  161. JSONElement distance = joint.key_or_nil("distance");
  162. JSONElement breakable = joint.key_or_nil("breakable");
  163. JSONElement break_force = joint.key_or_nil("break_force");
  164. JSONElement break_torque = joint.key_or_nil("break_torque");
  165. PhysicsJoint pj;
  166. pj.name = keys[k].to_string_id();
  167. DynamicString jtype; type.string_value(jtype);
  168. pj.type = joint_type_to_enum(jtype.c_str());
  169. pj.actor_0 = actor_0.string_id_value();
  170. pj.actor_1 = actor_1.string_id_value();
  171. pj.anchor_0 = Vector3(anchor_0[0].float_value(), anchor_0[1].float_value(), anchor_0[2].float_value());
  172. pj.anchor_1 = Vector3(anchor_1[0].float_value(), anchor_1[1].float_value(), anchor_1[2].float_value());
  173. pj.restitution = restitution.is_nil() ? 0.5 : restitution.float_value();
  174. pj.spring = spring.is_nil() ? 100.0 : spring.float_value();
  175. pj.damping = damping.is_nil() ? 0.0 : damping.float_value();
  176. pj.distance = distance.is_nil() ? 1.0 : distance.float_value();
  177. pj.breakable = breakable.is_nil() ? false : breakable.bool_value();
  178. pj.break_force = break_force.is_nil() ? 3000.0 : break_force.float_value();
  179. pj.break_torque = break_torque.is_nil() ? 1000.0 : break_torque.float_value();
  180. joints.push_back(pj);
  181. }
  182. }
  183. //-----------------------------------------------------------------------------
  184. void compile(Filesystem& fs, const char* resource_path, File* out_file)
  185. {
  186. File* file = fs.open(resource_path, FOM_READ);
  187. char* buf = (char*)default_allocator().allocate(file->size());
  188. file->read(buf, file->size());
  189. JSONParser json(buf);
  190. JSONElement root = json.root();
  191. bool m_has_controller = false;
  192. PhysicsController m_controller;
  193. // Read controller
  194. JSONElement controller = root.key_or_nil("controller");
  195. if (controller.is_nil())
  196. {
  197. m_has_controller = false;
  198. }
  199. else
  200. {
  201. parse_controller(controller, m_controller);
  202. m_has_controller = true;
  203. }
  204. List<PhysicsActor> m_actors(default_allocator());
  205. List<uint32_t> m_shapes_indices(default_allocator());
  206. List<PhysicsShape> m_shapes(default_allocator());
  207. List<PhysicsJoint> m_joints(default_allocator());
  208. if (root.has_key("actors")) parse_actors(root.key("actors"), m_actors, m_shapes, m_shapes_indices);
  209. if (root.has_key("joints")) parse_joints(root.key("joints"), m_joints);
  210. fs.close(file);
  211. default_allocator().deallocate(buf);
  212. PhysicsHeader h;
  213. h.version = 1;
  214. h.num_controllers = m_has_controller ? 1 : 0;
  215. h.num_actors = m_actors.size();
  216. h.num_shapes_indices = m_shapes_indices.size();
  217. h.num_shapes = m_shapes.size();
  218. h.num_joints = m_joints.size();
  219. uint32_t offt = sizeof(PhysicsHeader);
  220. h.controller_offset = offt; offt += sizeof(PhysicsController) * h.num_controllers;
  221. h.actors_offset = offt; offt += sizeof(PhysicsActor) * h.num_actors;
  222. h.shapes_indices_offset = offt; offt += sizeof(uint32_t) * h.num_shapes_indices;
  223. h.shapes_offset = offt; offt += sizeof(PhysicsShape) * h.num_shapes;
  224. h.joints_offset = offt;
  225. out_file->write((char*) &h, sizeof(PhysicsHeader));
  226. if (m_has_controller)
  227. {
  228. out_file->write((char*) &m_controller, sizeof(PhysicsController));
  229. }
  230. if (m_actors.size())
  231. {
  232. out_file->write((char*) m_actors.begin(), sizeof(PhysicsActor) * m_actors.size());
  233. }
  234. if (m_shapes_indices.size())
  235. {
  236. out_file->write((char*) m_shapes_indices.begin(), sizeof(uint32_t) * m_shapes_indices.size());
  237. }
  238. if (m_shapes.size())
  239. {
  240. out_file->write((char*) m_shapes.begin(), sizeof(PhysicsShape) * m_shapes.size());
  241. }
  242. if (m_joints.size())
  243. {
  244. out_file->write((char*) m_joints.begin(), sizeof(PhysicsJoint) * m_joints.size());
  245. }
  246. }
  247. } // namespace physics_resource
  248. namespace physics_config_resource
  249. {
  250. struct ObjectName
  251. {
  252. StringId32 name;
  253. uint32_t index;
  254. bool operator()(const ObjectName& a, const ObjectName& b)
  255. {
  256. return a.name < b.name;
  257. }
  258. };
  259. struct NameToMask
  260. {
  261. StringId32 name;
  262. uint32_t mask;
  263. };
  264. uint32_t collides_with_to_mask(Vector<DynamicString>& collides_with, List<NameToMask>& name_to_mask)
  265. {
  266. uint32_t mask = 0;
  267. for (uint32_t i = 0; i < collides_with.size(); i++)
  268. {
  269. StringId32 cur_name = collides_with[i].to_string_id();
  270. for (uint32_t j = 0; j < name_to_mask.size(); j++)
  271. {
  272. if (cur_name == name_to_mask[j].name) mask |= name_to_mask[j].mask;
  273. }
  274. }
  275. return mask;
  276. }
  277. uint32_t collision_filter_to_mask(const char* filter, List<NameToMask> name_to_mask)
  278. {
  279. StringId32 filter_hash = hash::murmur2_32(filter, string::strlen(filter));
  280. for (uint32_t i = 0; i < name_to_mask.size(); i++)
  281. {
  282. if (name_to_mask[i].name == filter_hash) return name_to_mask[i].mask;
  283. }
  284. CE_ASSERT(false, "Collision filter '%s' not found", filter);
  285. return 0;
  286. }
  287. void parse_materials(JSONElement e, List<ObjectName>& names, List<PhysicsMaterial>& objects)
  288. {
  289. Vector<DynamicString> keys(default_allocator());
  290. e.key_value(keys);
  291. for (uint32_t i = 0; i < keys.size(); i++)
  292. {
  293. JSONElement material = e.key(keys[i].c_str());
  294. JSONElement static_friction = material.key("static_friction");
  295. JSONElement dynamic_friction = material.key("dynamic_friction");
  296. JSONElement restitution = material.key("restitution");
  297. // Read material name
  298. ObjectName mat_name;
  299. mat_name.name = keys[i].to_string_id();
  300. mat_name.index = i;
  301. // Read material object
  302. PhysicsMaterial mat;
  303. mat.static_friction = static_friction.float_value();
  304. mat.dynamic_friction = dynamic_friction.float_value();
  305. mat.restitution = restitution.float_value();
  306. names.push_back(mat_name);
  307. objects.push_back(mat);
  308. }
  309. }
  310. void parse_shapes(JSONElement e, List<NameToMask>& name_to_mask, List<ObjectName>& names, List<PhysicsShape2>& objects)
  311. {
  312. Vector<DynamicString> keys(default_allocator());
  313. e.key_value(keys);
  314. for (uint32_t i = 0; i < keys.size(); i++)
  315. {
  316. JSONElement shape = e.key(keys[i].c_str());
  317. JSONElement collision_filter = shape.key("collision_filter");
  318. JSONElement trigger = shape.key("trigger");
  319. // Read shape name
  320. ObjectName shape_name;
  321. shape_name.name = keys[i].to_string_id();
  322. shape_name.index = i;
  323. // Read shape object
  324. PhysicsShape2 ps2;
  325. ps2.trigger = trigger.bool_value();
  326. DynamicString cfilter; collision_filter.string_value(cfilter);
  327. ps2.collision_filter = collision_filter_to_mask(cfilter.c_str(), name_to_mask);
  328. names.push_back(shape_name);
  329. objects.push_back(ps2);
  330. }
  331. }
  332. void parse_actors(JSONElement e, List<ObjectName>& names, List<PhysicsActor2>& objects)
  333. {
  334. Vector<DynamicString> keys(default_allocator());
  335. e.key_value(keys);
  336. for (uint32_t i = 0; i < keys.size(); i++)
  337. {
  338. JSONElement actor = e.key(keys[i].c_str());
  339. JSONElement linear_damping = actor.key_or_nil("linear_damping");
  340. JSONElement angular_damping = actor.key_or_nil("angular_damping");
  341. JSONElement dynamic = actor.key_or_nil("dynamic");
  342. JSONElement kinematic = actor.key_or_nil("kinematic");
  343. JSONElement disable_gravity = actor.key_or_nil("disable_gravity");
  344. // Read actor name
  345. ObjectName actor_name;
  346. actor_name.name = keys[i].to_string_id();
  347. actor_name.index = i;
  348. // Read actor object
  349. PhysicsActor2 pa2;
  350. //actor.collision_filter = coll_filter.to_string_id();
  351. pa2.linear_damping = linear_damping.is_nil() ? 0.0 : linear_damping.float_value();
  352. pa2.angular_damping = angular_damping.is_nil() ? 0.05 : angular_damping.float_value();
  353. pa2.flags = 0;
  354. if (!dynamic.is_nil())
  355. {
  356. pa2.flags |= dynamic.bool_value() ? : 0;
  357. }
  358. if (!kinematic.is_nil())
  359. {
  360. pa2.flags |= kinematic.bool_value() ? PhysicsActor2::KINEMATIC : 0;
  361. }
  362. if (!disable_gravity.is_nil())
  363. {
  364. pa2.flags |= disable_gravity.bool_value() ? PhysicsActor2::DISABLE_GRAVITY : 0;
  365. }
  366. names.push_back(actor_name);
  367. objects.push_back(pa2);
  368. }
  369. }
  370. void parse_collision_filters(JSONElement e, List<ObjectName>& names, List<PhysicsCollisionFilter>& objects, List<NameToMask>& name_to_mask)
  371. {
  372. Vector<DynamicString> keys(default_allocator());
  373. e.key_value(keys);
  374. // Assign a unique mask to each collision filter
  375. for (uint32_t i = 0; i < keys.size(); i++)
  376. {
  377. NameToMask ntm;
  378. ntm.name = keys[i].to_string_id();
  379. ntm.mask = 1 << i;
  380. name_to_mask.push_back(ntm);
  381. }
  382. for (uint32_t i = 0; i < keys.size(); i++)
  383. {
  384. JSONElement filter = e.key(keys[i].c_str());
  385. JSONElement collides_with = filter.key("collides_with");
  386. // Read filter name
  387. ObjectName filter_name;
  388. filter_name.name = keys[i].to_string_id();
  389. filter_name.index = i;
  390. // Build mask
  391. Vector<DynamicString> collides_with_vector(default_allocator());
  392. collides_with.array_value(collides_with_vector);
  393. PhysicsCollisionFilter pcf;
  394. pcf.mask = collides_with_to_mask(collides_with_vector, name_to_mask);
  395. printf("FILTER: %s, mask = %X\n", keys[i].c_str(), pcf.mask);
  396. names.push_back(filter_name);
  397. objects.push_back(pcf);
  398. }
  399. }
  400. void compile(Filesystem& fs, const char* resource_path, File* out_file)
  401. {
  402. File* file = fs.open(resource_path, FOM_READ);
  403. char* buf = (char*)default_allocator().allocate(file->size());
  404. file->read(buf, file->size());
  405. JSONParser json(buf);
  406. JSONElement root = json.root();
  407. List<ObjectName> material_names(default_allocator());
  408. List<PhysicsMaterial> material_objects(default_allocator());
  409. List<ObjectName> shape_names(default_allocator());
  410. List<PhysicsShape2> shape_objects(default_allocator());
  411. List<ObjectName> actor_names(default_allocator());
  412. List<PhysicsActor2> actor_objects(default_allocator());
  413. List<ObjectName> filter_names(default_allocator());
  414. List<PhysicsCollisionFilter> filter_objects(default_allocator());
  415. List<NameToMask> name_to_mask(default_allocator());
  416. // Parse materials
  417. if (root.has_key("collision_filters")) parse_collision_filters(root.key("collision_filters"), filter_names, filter_objects, name_to_mask);
  418. if (root.has_key("materials")) parse_materials(root.key("materials"), material_names, material_objects);
  419. if (root.has_key("shapes")) parse_shapes(root.key("shapes"), name_to_mask, shape_names, shape_objects);
  420. if (root.has_key("actors")) parse_actors(root.key("actors"), actor_names, actor_objects);
  421. default_allocator().deallocate(buf);
  422. fs.close(file);
  423. // Sort objects by name
  424. std::sort(material_names.begin(), material_names.end(), ObjectName());
  425. std::sort(shape_names.begin(), shape_names.end(), ObjectName());
  426. std::sort(actor_names.begin(), actor_names.end(), ObjectName());
  427. std::sort(filter_names.begin(), filter_names.end(), ObjectName());
  428. // Setup struct for writing
  429. PhysicsConfigHeader header;
  430. header.num_materials = material_names.size();
  431. header.num_shapes = shape_names.size();
  432. header.num_actors = actor_names.size();
  433. header.num_filters = filter_names.size();
  434. uint32_t offt = sizeof(PhysicsConfigHeader);
  435. header.materials_offset = offt;
  436. offt += sizeof(StringId32) * header.num_materials;
  437. offt += sizeof(PhysicsMaterial) * header.num_materials;
  438. header.shapes_offset = offt;
  439. offt += sizeof(StringId32) * header.num_shapes;
  440. offt += sizeof(PhysicsShape2) * header.num_shapes;
  441. header.actors_offset = offt;
  442. offt += sizeof(StringId32) * header.num_actors;
  443. offt += sizeof(PhysicsActor2) * header.num_actors;
  444. header.filters_offset = offt;
  445. offt += sizeof(StringId32) * header.num_filters;
  446. offt += sizeof(PhysicsCollisionFilter) * header.num_filters;
  447. // Write all
  448. out_file->write((char*) &header, sizeof(PhysicsConfigHeader));
  449. if (header.num_materials)
  450. {
  451. // Write material names
  452. for (uint32_t i = 0; i < material_names.size(); i++)
  453. {
  454. out_file->write((char*) &material_names[i].name, sizeof(StringId32));
  455. }
  456. // Write material objects
  457. for (uint32_t i = 0; i < material_names.size(); i++)
  458. {
  459. out_file->write((char*) &material_objects[material_names[i].index], sizeof(PhysicsMaterial));
  460. }
  461. }
  462. if (header.num_shapes)
  463. {
  464. // Write shape names
  465. for (uint32_t i = 0; i < shape_names.size(); i++)
  466. {
  467. out_file->write((char*) &shape_names[i].name, sizeof(StringId32));
  468. }
  469. // Write material objects
  470. for (uint32_t i = 0; i < shape_names.size(); i++)
  471. {
  472. out_file->write((char*) &shape_objects[shape_names[i].index], sizeof(PhysicsShape2));
  473. }
  474. }
  475. if (header.num_actors)
  476. {
  477. // Write shape names
  478. for (uint32_t i = 0; i < actor_names.size(); i++)
  479. {
  480. out_file->write((char*) &actor_names[i].name, sizeof(StringId32));
  481. }
  482. // Write material objects
  483. for (uint32_t i = 0; i < actor_names.size(); i++)
  484. {
  485. out_file->write((char*) &actor_objects[actor_names[i].index], sizeof(PhysicsActor2));
  486. }
  487. }
  488. if (header.num_filters)
  489. {
  490. // Write shape names
  491. for (uint32_t i = 0; i < filter_names.size(); i++)
  492. {
  493. out_file->write((char*) &filter_names[i].name, sizeof(StringId32));
  494. }
  495. // Write material objects
  496. for (uint32_t i = 0; i < filter_names.size(); i++)
  497. {
  498. out_file->write((char*) &filter_objects[filter_names[i].index], sizeof(PhysicsCollisionFilter));
  499. }
  500. }
  501. }
  502. } // namespace physics_config_resource
  503. } // namespace crown