private static PMXFormat.Rigidbody ConvertRigidbody(PMDFormat pmd, int rigidbody_index) { PMXFormat.Rigidbody result = new PMXFormat.Rigidbody(); PMDFormat.Rigidbody pmd_rigidbody = pmd.rigidbody_list.rigidbody[rigidbody_index]; result.name = pmd_rigidbody.rigidbody_name; result.english_name = ""; result.rel_bone_index = (uint)pmd_rigidbody.rigidbody_rel_bone_index; result.group_index = pmd_rigidbody.rigidbody_group_index; result.ignore_collision_group = pmd_rigidbody.rigidbody_group_target; result.shape_type = (PMXFormat.Rigidbody.ShapeType)pmd_rigidbody.shape_type; result.shape_size = new Vector3(pmd_rigidbody.shape_w, pmd_rigidbody.shape_h, pmd_rigidbody.shape_d); result.collider_position = pmd_rigidbody.pos_pos; if (pmd_rigidbody.rigidbody_rel_bone_index < pmd.bone_list.bone.Length) { result.collider_position += pmd.bone_list.bone[pmd_rigidbody.rigidbody_rel_bone_index].bone_head_pos; } else { result.collider_position += pmd.bone_list.bone[0].bone_head_pos; } result.collider_rotation = pmd_rigidbody.pos_rot; result.weight = pmd_rigidbody.rigidbody_weight; result.position_dim = pmd_rigidbody.rigidbody_pos_dim; result.rotation_dim = pmd_rigidbody.rigidbody_rot_dim; result.recoil = pmd_rigidbody.rigidbody_recoil; result.friction = pmd_rigidbody.rigidbody_friction; result.operation_type = (PMXFormat.Rigidbody.OperationType)pmd_rigidbody.rigidbody_type; return(result); }
private PMXFormat.Rigidbody ReadRigidbody() { PMXFormat.Rigidbody result = new PMXFormat.Rigidbody(); result.name = ReadString(); result.english_name = ReadString(); result.rel_bone_index = CastIntRead(binary_reader_, format_.header.boneIndexSize); result.group_index = binary_reader_.ReadByte(); result.ignore_collision_group = binary_reader_.ReadUInt16(); result.shape_type = (PMXFormat.Rigidbody.ShapeType)binary_reader_.ReadByte(); result.shape_size = ReadSinglesToVector3(binary_reader_); result.collider_position = ReadSinglesToVector3(binary_reader_); result.collider_rotation = ReadSinglesToVector3(binary_reader_); result.weight = binary_reader_.ReadSingle(); result.position_dim = binary_reader_.ReadSingle(); result.rotation_dim = binary_reader_.ReadSingle(); result.recoil = binary_reader_.ReadSingle(); result.friction = binary_reader_.ReadSingle(); result.operation_type = (PMXFormat.Rigidbody.OperationType)binary_reader_.ReadByte(); return(result); }
private PMXFormat.Rigidbody ReadRigidbody() { PMXFormat.Rigidbody result = new PMXFormat.Rigidbody(); result.name = ReadString(); result.english_name = ReadString(); result.rel_bone_index = CastIntRead(binary_reader_, format_.header.boneIndexSize); result.group_index = binary_reader_.ReadByte(); result.ignore_collision_group = binary_reader_.ReadUInt16(); result.shape_type = (PMXFormat.Rigidbody.ShapeType)binary_reader_.ReadByte(); result.shape_size = ReadSinglesToVector3(binary_reader_); result.collider_position = ReadSinglesToVector3(binary_reader_); result.collider_rotation = ReadSinglesToVector3(binary_reader_); result.weight = binary_reader_.ReadSingle(); result.position_dim = binary_reader_.ReadSingle(); result.rotation_dim = binary_reader_.ReadSingle(); result.recoil = binary_reader_.ReadSingle(); result.friction = binary_reader_.ReadSingle(); result.operation_type = (PMXFormat.Rigidbody.OperationType)binary_reader_.ReadByte(); return result; }
private static PMXFormat.Rigidbody ConvertRigidbody(PMDFormat pmd, int rigidbody_index) { PMXFormat.Rigidbody result = new PMXFormat.Rigidbody(); PMDFormat.Rigidbody pmd_rigidbody = pmd.rigidbody_list.rigidbody[rigidbody_index]; result.name = pmd_rigidbody.rigidbody_name; result.english_name = ""; result.rel_bone_index = (uint)pmd_rigidbody.rigidbody_rel_bone_index; result.group_index = pmd_rigidbody.rigidbody_group_index; result.ignore_collision_group = pmd_rigidbody.rigidbody_group_target; result.shape_type = (PMXFormat.Rigidbody.ShapeType)pmd_rigidbody.shape_type; result.shape_size = new Vector3(pmd_rigidbody.shape_w, pmd_rigidbody.shape_h, pmd_rigidbody.shape_d); result.collider_position = pmd_rigidbody.pos_pos; if (pmd_rigidbody.rigidbody_rel_bone_index < pmd.bone_list.bone.Length) { result.collider_position += pmd.bone_list.bone[pmd_rigidbody.rigidbody_rel_bone_index].bone_head_pos; } else { result.collider_position += pmd.bone_list.bone[0].bone_head_pos; } result.collider_rotation = pmd_rigidbody.pos_rot; result.weight = pmd_rigidbody.rigidbody_weight; result.position_dim = pmd_rigidbody.rigidbody_pos_dim; result.rotation_dim = pmd_rigidbody.rigidbody_rot_dim; result.recoil = pmd_rigidbody.rigidbody_recoil; result.friction = pmd_rigidbody.rigidbody_friction; result.operation_type = (PMXFormat.Rigidbody.OperationType)pmd_rigidbody.rigidbody_type; return result; }