-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.0] BREAKING Update LookAt #964
Conversation
Rewrite angle math using RAD2DEG and DEG2RAD
… euler - Add new accessors `yaw` and `pitch` to `VRMLookAt` - Arguments of `VRMLookAtApplier.lookAt` has been changed - `VRMLookAt.euler` - `VRMLookAt._calcEuler` has been renamed to `VRMLookAt._updateYawPitchByPosition` considering its role - `VRMLookAt` now uses its protected member `_needsUpdate` to check whether it should apply its yaw and pitch to its applier or not - Be aware that yaw and pitch won't be applied until you call `update` !
- `apply` receives `yaw` and `pitch` - `lookAt` is preserved and receives `euler` but it's deprecated
… `VRMLookAt` - `_updateYawPitchByPosition` is removed and integrated to `lookAt`
Follow latest lookAt API
- yaw, pitch was not compatible between VRM0.0 and VRM1.0, I have to add `faceFront` to `VRMLookAtBoneApplier` - VRMLookAtHelper also needs `faceFront`, I added a function `getFaceFrontQuaternion` to `VRMLookAt` - `VRMLookAtBoneApplier` was not compatible with eye bones which have non-uniform rest rotation, I fixed this by considering the rest rotation of eye bones - I wanted to test new utility functions, setup jest for `three-vrm-core`
- `VRMLookAt.getEuler()` should be used instead
namely, `VRMLookAtApplier.lookAt()`
…MLookAt.autoUpdate` is `false`
* @param vector The vector | ||
* @returns A tuple contains two angles, `[ azimuth, altitude ]` | ||
*/ | ||
export function calcAzimuthAltitude(vector: THREE.Vector3): [ azimuth: number, altitude: number ] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftEye.quaternion | ||
.copy(_quatB) | ||
.premultiply(_quatA) | ||
.premultiply(_quatB.invert()) | ||
.multiply(this._restQuatLeftEye); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quatB^-1 * quatA * quatB * restQuatLeftEye
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
なんでpremultiplyしたかっていうと、 _quatB.invert()
を2回叩きたくなかったから……
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftEye.quaternion | |
.copy(_quatB) | |
.premultiply(_quatA) | |
.premultiply(_quatB.invert()) | |
.multiply(this._restQuatLeftEye); | |
// quatB^-1 * quatA * quatB * restQuatLeftEye | |
leftEye.quaternion | |
.copy(_quatB) | |
.premultiply(_quatA) | |
.premultiply(_quatB.invert()) | |
.multiply(this._restQuatLeftEye); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c94396b で対応しました
99d96fc : deprecatedにした |
Description
There are many changes in this PR.
I have added descriptions for each commit; you might want to see each in order.
The primary purpose of this PR is to make
VRMLookAt
able to use manually setyaw
andpitch
.yaw
andpitch
manually.yaw
andpitch
(formerlyeuler
).VRMLookAtBoneApplier
is now compatible with eye bones witch have non-uniform rest rotations.VRMLookAtHelper
now works properly on VRM0.0.VRMLookAtHelper
now hides target gizmo whenVRMLookAt.autoUpdate
isfalse
.Breaking Changes
VRMLookAt.euler
is deprecated. Useyaw
andpitch
, orgetEuler()
instead.VRMLookAt._calcEuler()
is removed. UseVRMLookAt.lookAt()
instead.VRMLookAt
is now not applied to its applier immediately.VRMLookAt
has its internal flag_needsUpdate
, and it's applied when we call itsupdate()
VRMLookAtApplier.lookAt()
is deprecated. UseapplyYawPitch()
instead.VRMLookAtBoneApplier
now requiresfaceFront
in order to use with VRM0.0 models.VRMLookAtLoaderPlugin
Points need review