JCPalmer Posted September 19, 2016 Share Posted September 19, 2016 I found myself making a class called MatrixComp, which is the rotation, translation, & scaling components of a BABYLON.Matrix broken out. When trying to scale the matrices of a pose from a library, more than just scaling the translation is required to account for skeletons which might have different postures / builds (rotation at rest). Otherwise, the skeleton assumes the posture of the skeleton used to make the library, which can look weird. I added methods to compute the ratios of each component's rest value (called basis) to the rest value that of the library. Often, the translation of a dimension is zero, so using the divide function results in a NaN. I wrote my own, shown below. Is there any interest in changing the division behavior to this? a NaN is really not useful. this.translationBasisRatio = BABYLON.Vector3.Zero(); if (libraryBasis.translation.x !== 0) this.translationBasisRatio.x = this.translation.x / libraryBasis.translation.x; if (libraryBasis.translation.y !== 0) this.translationBasisRatio.y = this.translation.y / libraryBasis.translation.y; if (libraryBasis.translation.z !== 0) this.translationBasisRatio.z = this.translation.z / libraryBasis.translation.z; Also, there is no divide for a Quaternion, but this equivalent. Maybe, a wrapper? this.rotationBasisRatio = this.rotation.multiply(BABYLON.Quaternion.Inverse(libraryBasis.rotation)); I also ended up with my own versions of Vector3.LerpToRef & SlerpToRef. I am fine keeping all of this in my code, but some could be moved if wanted. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 20, 2016 Share Posted September 20, 2016 As i asked in another post, please merge it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.