Changeset 539 for trunk/src/engine/ragdoll_manager.cc
- Timestamp:
- 01/24/17 17:55:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/ragdoll_manager.cc
r524 r539 26 26 NV_ASSERT_ALWAYS( m_world, "Physics world not setup in ragdoll_manager!" ); 27 27 bool result = false; 28 nv::string64 model_id = table .get_string64( "model");28 nv::string64 model_id = table["model"].get_string64(); 29 29 nv::resource< model > mr = m_model->get( model_id ); 30 30 if ( !mr ) return false; … … 66 66 if ( auto bind_data = rbind.lock() ) 67 67 { 68 data->id = table .get_string32( "id");68 data->id = table["id"].get_string32(); 69 69 int index = data->parts.size(); 70 70 data->parts.emplace_back(); 71 71 auto& part = data->parts.back(); 72 part.name = table .get_string_hash_64( "name");73 part.bone_id = nv::uint32( bind_data->get_bone_list().resolve( table .get_string_hash_64( "bone") ) );72 part.name = table["name"].get_shash64(); 73 part.bone_id = nv::uint32( bind_data->get_bone_list().resolve( table["bone"].get_shash64() ) ); 74 74 NV_ASSERT( part.bone_id < 256, "Bone ID not found!" ); 75 float radius = table .get_float( "radius");75 float radius = table["radius"].get_f32(); 76 76 float length = 0.0f; 77 77 if ( table.has_field( "target" ) ) 78 78 { 79 79 const auto& of = bind_data->get_bone_transforms().m_offsets; 80 int target = bind_data->get_bone_list().resolve( table .get_string_hash_64( "target") );80 int target = bind_data->get_bone_list().resolve( table["target"].get_shash64() ); 81 81 if ( target < 0 ) return false; 82 82 length = math::distance( of[part.bone_id].get_position(), of[target].get_position() ); … … 84 84 else 85 85 { 86 length = table .get_float( "length");86 length = table["length"].get_f32(); 87 87 } 88 88 NV_ASSERT( radius > 0.0f && length > 0.0f, "Bad parameters!" ); 89 89 part.shape = m_world->create_capsule( radius, length ); 90 90 part.parent_idx = pindex; 91 part.mass = table .get_float( "mass",1.0f );91 part.mass = table["mass"].get_f32( 1.0f ); 92 92 part.cone_twist = false; 93 93 // Joints 94 94 if ( pindex != -1 ) 95 95 { 96 part.cone_twist = table .get_string_hash_64("joint") == shash64( "cone_twist"_ls );97 part.limits = table .get< vec3 >( "limits");96 part.cone_twist = table["joint"].get_shash64() == shash64( "cone_twist"_ls ); 97 part.limits = table["limits"].as< vec3 >(); 98 98 } 99 99 uint32 child_count = table.get_size();
Note: See TracChangeset
for help on using the changeset viewer.