* Resets the skeleton to the base pose.
()
| 151 | * Resets the skeleton to the base pose. |
| 152 | */ |
| 153 | pose() { |
| 154 | |
| 155 | // recover the bind-time world matrices |
| 156 | |
| 157 | for ( let i = 0, il = this.bones.length; i < il; i ++ ) { |
| 158 | |
| 159 | const bone = this.bones[ i ]; |
| 160 | |
| 161 | if ( bone ) { |
| 162 | |
| 163 | bone.matrixWorld.copy( this.boneInverses[ i ] ).invert(); |
| 164 | |
| 165 | } |
| 166 | |
| 167 | } |
| 168 | |
| 169 | // compute the local matrices, positions, rotations and scales |
| 170 | |
| 171 | for ( let i = 0, il = this.bones.length; i < il; i ++ ) { |
| 172 | |
| 173 | const bone = this.bones[ i ]; |
| 174 | |
| 175 | if ( bone ) { |
| 176 | |
| 177 | if ( bone.parent && bone.parent.isBone ) { |
| 178 | |
| 179 | bone.matrix.copy( bone.parent.matrixWorld ).invert(); |
| 180 | bone.matrix.multiply( bone.matrixWorld ); |
| 181 | |
| 182 | } else { |
| 183 | |
| 184 | bone.matrix.copy( bone.matrixWorld ); |
| 185 | |
| 186 | } |
| 187 | |
| 188 | bone.matrix.decompose( bone.position, bone.quaternion, bone.scale ); |
| 189 | |
| 190 | } |
| 191 | |
| 192 | } |
| 193 | |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Resets the skeleton to the base pose. |